-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add new function shell_tools.run #5528
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
Conversation
A thin wrapper to subprocess.run with an extra options to log command arguments to stderr.
Default the `capture_output`, `check`, and `text` arguments to True to approximate behavior of run_cmd.
Premature PR - please hold with review... |
3419bc4
to
9e9d9a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
One thought on documentation, but however you decide is good.
**subprocess_run_kwargs, | ||
) -> subprocess.CompletedProcess: | ||
"""Call subprocess.run with an option to log executed command to stderr. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe something to distinguish why you would use this and not run_cmd below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack. I actually plan to remove run_cmd and run_shell in a followup PR and only use the run()
function.
This PR is 1 of 4 for #4394.
Thanks for quick review.
Add shell_tools.run, a thin wrapper to subprocess.run with a few extra arguments for showing the executed commands. It also supplies updated default values for subprocess.run to approximate behavior of run_cmd and run_shell functions. The purpose of this function is to replace the run_cmd and run_shell functions in the shell_tools module. Partially implements quantumlib#4394
Add shell_tools.run, a thin wrapper to subprocess.run with
a few extra arguments for showing the executed commands.
It also supplies updated default values for subprocess.run
to approximate behavior of run_cmd and run_shell functions.
The purpose of this function is to replace the run_cmd and
run_shell functions in the shell_tools module.
Partially implements #4394