classification
Title: hide command prompt when using subprocess.Popen with shell=False on Windows
Type: enhancement Stage: needs patch
Components: Library (Lib), Windows Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: eryksun, iMath, ohno, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords: easy

Created on 2017-04-16 17:26 by iMath, last changed 2018-11-19 11:43 by steve.dower.

Pull Requests
URL Status Linked Edit
PR 3013 closed jeffreyrack, 2017-08-07 05:18
Messages (4)
msg291760 - (view) Author: Philip Lee (iMath) Date: 2017-04-16 17:26
First, It is nearly useless for the command prompt to pop up during  the running time of subprocess.Popen with shell=False.
Second, the popping up command prompt would interrupt users and do bad to user experience of GUI applications.
Third, I found QProcess within Qt won't pop up the command prompt  in using.

It would be convenient to add an argument to suppress the command prompt from popping up when using subprocess.Popen with shell=False on Windows, many users are missing the feature and these are many similar feature request questions like the following 
http://stackoverflow.com/questions/7006238/how-do-i-hide-the-console-when-i-use-os-system-or-subprocess-call
http://stackoverflow.com/questions/1765078/how-to-avoid-console-window-with-pyw-file-containing-os-system-call/12964900#12964900
http://stackoverflow.com/questions/1016384/cross-platform-subprocess-with-hidden-window
msg291815 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2017-04-17 23:40
Hiding the console is required often enough that a keyword-only parameter for this would be useful. Other platforms could simply ignore it, in contrast to writing platform-dependent code that passes startupinfo. Note that this option would also hide the window of GUI programs that do not (intentionally) ignore SW_HIDE, such as notepad.
msg329979 - (view) Author: neel patel (ohno) Date: 2018-11-16 03:00
Can I work on this? I'm not sure of it's status, though.
msg330091 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2018-11-19 11:43
Looks like it's available.

It will be a new subprocess option to not create a new window. The underlying issue is that some applications always request a console, and if your own application doesn't have one then Windows will create it. Normally you would fix this in the target application, but we can offer an option to try and force any new windows to be hidden (though as Eryk points out, it may cause unexpected behaviour and so should not be the default).
History
Date User Action Args
2018-11-19 11:43:20steve.dowersetmessages: + msg330091
versions: + Python 3.8, - Python 3.7
2018-11-16 03:00:40ohnosetnosy: + ohno
messages: + msg329979
2017-08-07 05:18:35jeffreyracksetpull_requests: + pull_request3046
2017-04-17 23:40:37eryksunsetcomponents: + Windows
versions: + Python 3.7
keywords: + easy
nosy: + paul.moore, tim.golden, eryksun, zach.ware, steve.dower

messages: + msg291815
stage: needs patch
2017-04-16 17:26:26iMathcreate