-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception while running inproc #269
Comments
That is intentional. |
Maybe it's a good idea to optionally override this behavior? |
@viviag Maybe |
@PierreR Thank you! It works, I didn't check it properly last time I tried. |
@PierreR No, I'm wrong only now, sorry for haste.
|
With the latest patch on gitOutput :: Shell (Maybe Line)
gitOutput = (Just <$> inproc "git" ["describe"] empty) `catch` \(e :: ExitCode) -> pure Nothing I agree with the api throwing exception in this case as it depends on the interpretation of the user to decide whether a non-zero exit code is recoverable or not - in fact, the program being called is relying on this exit code mechanism to communicate additional info beyond text output. As long as it's sufficiently straightforward to write exception handling code, e.g. with the example here now one can differentiate between 'having annotated code' vs 'no annotated code' (or you can simple do |
Yeah, I recommend using the newly added support for |
A warning (I got bitten by this): the All in all, I still don't know how to write a |
@neongreen: You can use a non-streaming solution to get |
Sure, but I want a streaming solution. |
@neongreen: Yeah, in that case you'll probably have to store results in a buffer. The API doesn't provide a way to resume where a stream left off in the event of an exception. |
I'm not sure what it means to continue after getting an exit code, but in the case where I just want an exit code and the data, but still using streams, without needing to...continue - how can I do that? Edit: after some fiddling I got the git output example to work, though having to wrap it in another layer of Either feels a bit clumsy - I'm not an expert however. view $ Control.Monad.Catch.catch
((Right <$> inshellWithErr "seq 1 10; false" empty) <|> (select [Left ExitSuccess]))
(\(e :: ExitCode) -> pure $ Left e) |
Resolver
nightly-2017-12-08
:Program dies with no error message on the line
view $ inproc "git" ["describe"] empty
orsh $ inproc "git" ["describe"] empty
etc.When trying to use
inprocWithErr
I seeLeft ...
but it even dies.in
GHCI
:The text was updated successfully, but these errors were encountered: