mirror of
https://github.com/utdemir/nix-tree.git
synced 2024-09-11 14:55:44 +03:00
clipboard: Don't grab std{err,out}
For some reason it was breaking System.Timeout.timeout
This commit is contained in:
parent
b8fae3d936
commit
27e7c2ccfc
@ -6,6 +6,7 @@
|
|||||||
* Try `nix-tree nixpkgs#hello'
|
* Try `nix-tree nixpkgs#hello'
|
||||||
* change: `nix-tree` now requires an explicit `--derivation` flag to work on store derivations rather than their outputs.
|
* 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`.
|
* 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
|
[#27]: https://github.com/utdemir/nix-tree/issues/27
|
||||||
|
|
||||||
|
@ -20,21 +20,13 @@ runCmd :: Text -> (FilePath, [String]) -> IO (Either Text ())
|
|||||||
runCmd txt (cmd, args) =
|
runCmd txt (cmd, args) =
|
||||||
P.proc (toString cmd) (map toString args)
|
P.proc (toString cmd) (map toString args)
|
||||||
& P.setStdin (P.byteStringInput $ encodeUtf8 txt)
|
& P.setStdin (P.byteStringInput $ encodeUtf8 txt)
|
||||||
& P.readProcess
|
& P.runProcess
|
||||||
& timeout 1_000_000
|
& timeout 1_000_000
|
||||||
& try
|
& try
|
||||||
<&> \case
|
<&> \case
|
||||||
Right (Just (ExitSuccess, _, _)) -> Right ()
|
Right (Just ExitSuccess) -> Right ()
|
||||||
Right (Just (ExitFailure e, out, err)) ->
|
Right (Just (ExitFailure e)) ->
|
||||||
Left $
|
Left $ "failed with exit code " <> show e
|
||||||
"failed with exit code "
|
|
||||||
<> show e
|
|
||||||
<> ", "
|
|
||||||
<> "stdout: "
|
|
||||||
<> decodeUtf8 (toStrict out)
|
|
||||||
<> ", "
|
|
||||||
<> "stderr: "
|
|
||||||
<> decodeUtf8 (toStrict err)
|
|
||||||
Right Nothing ->
|
Right Nothing ->
|
||||||
Left $ "timed out"
|
Left $ "timed out"
|
||||||
Left (ex :: SomeException) ->
|
Left (ex :: SomeException) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user