-
-
Notifications
You must be signed in to change notification settings - Fork 639
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
Equivalent to bash's "&&" #137
Comments
I agree wholeheartedly. I would be happy to take this one on. |
I was already thinking whether the standard subprocess mode $[...] shouldn't return the command's exit code by default, however, a naive implementation would cause the exit code to be printed on screen then each time. Also, the "success" code is 0, which means it can't easily be used in standard Python comparisons, which is awkward. Alternatively, $[...] could return a StatusCode object, which would evaluate to True if the code was 0, False otherwise, and prints as an empty string, though that seems a bit hacky. However, I also believe that implementing such a behaviour would require quite a few internal changes, because the return code of subprocess commands isn't even currently stored as far as I remember. Just some food for thought @wrywerytwreywery, because I investigated this for a little while already :) |
Hi All, before anyone gets too far down the road on this, I'd like to make a few points:
I'd also like to note that precedence rules come in to play here. Thus the need for grouping with |
@scopatz You are right, using standard python operators for this would be more elegant. |
Great project! It would be very nice to have a keyword in xonsh that is equivalent to
&&
in bash/zsh or;and
in fish, meaning that it would execute if and only if is successful in the following example line:<A> <keyword> <B>
.For maximum "bashwards compatibility" the keyword should be exactly like in bash (&&) if possible.
For completeness' sake there should also be a keyword equivalent to
||
(bash/zsh) or;or
(fish) that only executes something if the preceding command fails.The current xonsh behavior (v0.1.2) for this syntax seems to be 100% cpu usage and doing nothing until I hit Ctrl+C
The text was updated successfully, but these errors were encountered: