-
-
Notifications
You must be signed in to change notification settings - Fork 503
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
Execution context (default arguments) for custom command? #559
Comments
Huh, I think you have found a bug, and I think it is reasonable to expect that |
I can't reproduce this on my own machine. @amoffat The beginning of |
@ecederstrand here is what I am using to reproduce: import sh
sh2 = sh(_ok_code=1)
sh2.ls() # raises
ls = sh2.Command("ls")
ls() # doesn't raise It seems that the arguments that should be "baked" into |
I created a minimal PR for this. The caveat is that |
I've updated the PR without the above caveat and added a test case. Not entirely happy with the code - it seems there should be a less complicated way. Suggestions welcome :-) |
LGTM @ecederstrand. Scoping the baked args to the environment-specific |
I want sh to output to always output stdout/stderr as if I'd run the commands in a bash script, for every single command. Using the doc at https://amoffat.github.io/sh/sections/default_arguments.html as guide, I created a new sh2 object with my default argument for _out. However, it doesn't work for custom Commands, only for built-in commands.
It's not specific to this tool, it's the same result if I use
myls = sh2.Command("/usr/bin/ls")
.The text was updated successfully, but these errors were encountered: