-
Notifications
You must be signed in to change notification settings - Fork 143
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
Hide command prompt on Windows when running subprocess. #136
Conversation
svn/common_base.py
Outdated
stderr=subprocess.STDOUT, | ||
cwd=wd, | ||
env=env) | ||
if sys.platform.lower().startswith('win'): |
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.
subprocess.STARTF_USESHOWWINDOW
is only defined in Windows. Just try to get it and handle AttributeError
if it doesn't exist. We don't want to get involved with detecting platform names.
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.
Done.
svn/common_base.py
Outdated
startupinfo = subprocess.STARTUPINFO() | ||
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW | ||
|
||
p = subprocess.Popen( |
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.
Just create an empty kwargs
variable above, add startupinfo
to it if we're in Windows, and expand/unsplat the kwargs into the existing call rather than duplicating it.
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.
Done.
svn/common_base.py
Outdated
startupinfo = subprocess.STARTUPINFO() | ||
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW | ||
|
||
p = subprocess.Popen( |
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.
While we're here, let's refactor to use subprocess.check_output()
rather than subprocess.Popen()
directly.
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.
That could go in another pull request as just a code refactor.
Also, unit-test coverage dropped by a third with your change. Please investigate. |
I've updated the pull request. Unsure why unit-test coverage dropped by a third. It is either unrelated to this pull request or coveralls reporting is inaccurate. Other pull requests have similar issues. |
544f7da
to
230a2cd
Compare
Closed due to ignored conflicts. |
No description provided.