-
Notifications
You must be signed in to change notification settings - Fork 91
Always use a sequence in args to subprocess.Popen() #52
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,8 +182,12 @@ def run(self, block=True, binary=False, cwd=None, env=None): | |
if cwd: | ||
popen_kwargs["cwd"] = cwd | ||
if env: | ||
popen_kwargs["env"].update(env) | ||
s = subprocess.Popen(self._popen_args, **popen_kwargs) | ||
popen_kwargs['env'].update(env) | ||
args = self._popen_args | ||
if not isinstance(args, str): | ||
# It is recommended to pass a sequence based on docs. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment, although correct, is confusing in this context since we're converting from sequence to string on the next line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will remove it. |
||
args = subprocess.list2cmdline(args) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An alternative could be to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it's better to set More over |
||
s = subprocess.Popen(args, **popen_kwargs) | ||
# Otherwise, use pexpect. | ||
else: | ||
pexpect_kwargs = self._default_pexpect_kwargs.copy() | ||
|
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.
Need to account for
unicode
string type in PY2.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.
If python2 is still relevant, are you fine with introducing
six
as a new dependency and usesix.string_types
?