sublime_terminal
sublime_terminal copied to clipboard
Hide Command prompt on Windows
Open Terminal Here briefly shows a cmd.exe
window before launching powershell.exe
This can be easily hidden by passing a startupinfo
argument to subprocess.Popen()
Would like me to submit a pull request?
if os.name == 'win':
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
subprocess.Popen(args, cwd=cwd, startupinfo=startupinfo)
else:
subprocess.Popen(args, cwd=cwd)
Bump!
up
How would that fix work if someone doesn't have powershell installed and they are launching cmd.exe
?
What versions of Windows are you running? I would just want to make sure this change doesn't break on different versions of Windows.
It has been 1 month since we replied on this issue but with no updates from the commenters. Closing this issue for now.
@twolfson This issue should be open. Although I use git bash without any bug but for those who use default powershell then this issue is occurring. @wbond On windows 8 this occurs for me :)
Alright, reopening issue
@shivapoudel Can you also provide the version of Sublime Text you are using so we can reproduce more easily?
I have successfully reproduced on an ievm for Windows 7 and Sublime Text 3. However, I am not too sure of the best approach. The one mentioned earlier seems like it will be problematic for non-bat invocations (e.g. cmd.exe
, Cmder.exe
) as it would hit the initial window.
@shivapoudel Do you have any solutions and would you be interested in opening a PR?
@twolfson Using Sublime Text 3 build 3083. Found temporary solution but not sure this will help all =/
{
"terminal": "powershell",
"parameters": []
}
Interesting. @wbond Can you provide insight into why we have a .bat
and don't invoke powershell.exe
?
Well, the subprocess package in Python uses cmd.exe to start the subprocess. If you launch powershell.exe through the subprocess package, powershell inherits the window dimensions of cmd.exe and the color scheme also. The batch script launches powershell with a ps1 script to reset the dimensions to something reasonable and the default color scheme.
In order to fix this issue "properly," and get rid of the batch script, I believe the solution would be to use the Win32 API to launch the powershell process. I have never done such a thing before, but it would need to be done through ctypes. My guess is a call to something like https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx.
@twolfson If you can then please help this bug fix ASAP. Sorry my bad luck but I haven't written python code till the date so I am unable to submit the PR.
I don't think this is a critical bug; it doesn't break anyone's UI. It causes a minor inconvenience which resolves itself.
I am inexperienced with Windows programming as well. I am going to leave this PR as "enhancement"/"help wanted" for anyone who wants to repair this and has knowledge of Windows (or has the time to learn).
@taragurung Do you have any solutions and would you be interested in opening a PR?
let me check
On Fri, Jul 17, 2015 at 2:52 PM, Shiva Poudel [email protected] wrote:
@taragurung https://github.com/taragurung Do you have any solutions and would you be interested in opening a PR?
— Reply to this email directly or view it on GitHub https://github.com/wbond/sublime_terminal/issues/65#issuecomment-122224980 .