diff --git a/CHANGELOG.md b/CHANGELOG.md index c45ec26..ec0945c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Try `nix-tree nixpkgs#hello' * change: `nix-tree` now requires an explicit `--derivation` flag to work on store derivations rather than their outputs. * This is to be more consistent `nix path-info`. +* fix: Fix timeout when running external command for the 'yank' functionality (issue: [#25][]) [#27]: https://github.com/utdemir/nix-tree/issues/27 diff --git a/src/NixTree/Clipboard.hs b/src/NixTree/Clipboard.hs index bbe4bfe..841872e 100644 --- a/src/NixTree/Clipboard.hs +++ b/src/NixTree/Clipboard.hs @@ -20,21 +20,13 @@ runCmd :: Text -> (FilePath, [String]) -> IO (Either Text ()) runCmd txt (cmd, args) = P.proc (toString cmd) (map toString args) & P.setStdin (P.byteStringInput $ encodeUtf8 txt) - & P.readProcess + & P.runProcess & timeout 1_000_000 & try <&> \case - Right (Just (ExitSuccess, _, _)) -> Right () - Right (Just (ExitFailure e, out, err)) -> - Left $ - "failed with exit code " - <> show e - <> ", " - <> "stdout: " - <> decodeUtf8 (toStrict out) - <> ", " - <> "stderr: " - <> decodeUtf8 (toStrict err) + Right (Just ExitSuccess) -> Right () + Right (Just (ExitFailure e)) -> + Left $ "failed with exit code " <> show e Right Nothing -> Left $ "timed out" Left (ex :: SomeException) ->