clipboard: Don't grab std{err,out}

For some reason it was breaking System.Timeout.timeout
This commit is contained in:
Utku Demir 2021-12-26 12:49:27 +13:00
parent b8fae3d936
commit 27e7c2ccfc
No known key found for this signature in database
GPG Key ID: F3F8629C3E0BF60B
2 changed files with 5 additions and 12 deletions

View File

@ -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

View File

@ -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) ->