mirror of
https://github.com/utdemir/nix-tree.git
synced 2024-08-16 18:20:37 +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'
|
||||
* 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
|
||||
|
||||
|
@ -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) ->
|
||||
|
Loading…
Reference in New Issue
Block a user