Skip to content
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

Capture failed pipeline #55

Open
pmatos opened this issue Jun 24, 2019 · 2 comments
Open

Capture failed pipeline #55

pmatos opened this issue Jun 24, 2019 · 2 comments

Comments

@pmatos
Copy link

pmatos commented Jun 24, 2019

I am starting to have more and more scripts using rash but they are quite flaky in general.
One thing I still haven't figured out the best way to achieve is grab a pipeline failure with the failing exit code. For example:

#lang rash
(define (my-false)
  {true
   echo "1"
   false
   echo "42"})

I get:

> (my-false)
1
; run-pipeline: unix pipeline-segment (#<path:/usr/bin/false>) terminated with code 1
; 
; Context:
;  /home/pmatos/.racket/7.3/pkgs/shell-pipeline/private/mixed-pipeline.rkt:161:6 for-loop
;  /home/pmatos/.racket/7.3/pkgs/shell-pipeline/private/mixed-pipeline.rkt:257:0 unpack21
;  /home/pmatos/Projects/igalia/jsc-utils/webkit.rkt:23:0 my-false
;  /home/pmatos/installs/racket-7.3/collects/racket/repl.rkt:11:26

I see the error call that terminates this in the rash source (https://github.com/willghatch/racket-rash/blob/master/shell-pipeline/private/mixed-pipeline.rkt) however this error call is less than ideal if I want to grab the error and the exit code. I could in principle catch the exception thrown by error (exn:fail) and parse the string, however this is less than ideal. Is there a good way to actually do this at the moment?

@willghatch
Copy link
Owner

willghatch commented Jun 24, 2019 via email

@pmatos
Copy link
Author

pmatos commented Jun 26, 2019

The flakiness comes exactly from this problem of not being able to properly catch failures. A new exception is exactly what I was thinking about. I will take a look at it later today and if I can put together something I will send a PR even if in draft mode. Glad you agree this can be improved. Thanks for rash - it's awesome - needs a marketing team!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants