Skip to content
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 #65

Open
shirhatti opened this issue Aug 6, 2014 · 16 comments
Open

Hide Command prompt on Windows #65

shirhatti opened this issue Aug 6, 2014 · 16 comments

Comments

@shirhatti
Copy link

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)
@shirhatti
Copy link
Author

Bump!

@AuthorProxy
Copy link

up

@twolfson
Copy link
Collaborator

How would that fix work if someone doesn't have powershell installed and they are launching cmd.exe?

@wbond
Copy link
Owner

wbond commented Jun 14, 2015

What versions of Windows are you running? I would just want to make sure this change doesn't break on different versions of Windows.

@twolfson
Copy link
Collaborator

It has been 1 month since we replied on this issue but with no updates from the commenters. Closing this issue for now.

@shivapoudel
Copy link

@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 :)

@twolfson
Copy link
Collaborator

Alright, reopening issue

@twolfson twolfson reopened this Jul 14, 2015
@twolfson
Copy link
Collaborator

@shivapoudel Can you also provide the version of Sublime Text you are using so we can reproduce more easily?

@twolfson
Copy link
Collaborator

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?

@shivapoudel
Copy link

@twolfson Using Sublime Text 3 build 3083. Found temporary solution but not sure this will help all =/

{
    "terminal": "powershell",
    "parameters": []
}

@twolfson
Copy link
Collaborator

Interesting. @wbond Can you provide insight into why we have a .bat and don't invoke powershell.exe?

@wbond
Copy link
Owner

wbond commented Jul 15, 2015

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.

@shivapoudel
Copy link

@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.

@twolfson
Copy link
Collaborator

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).

@shivapoudel
Copy link

@taragurung Do you have any solutions and would you be interested in opening a PR?

@taragurung
Copy link

let me check

On Fri, Jul 17, 2015 at 2:52 PM, Shiva Poudel notifications@github.com
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
#65 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants