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 CMD window on Windows #40

Closed
federico-terzi opened this issue May 8, 2020 · 4 comments
Closed

Hide CMD window on Windows #40

federico-terzi opened this issue May 8, 2020 · 4 comments

Comments

@federico-terzi
Copy link

Hi,
Thank you for the wonderful library.
I'm currently writing a tool on Windows that spawns commands through CMD and then gets the output. Using the standard std::process API, the prompt window flashes for a short while before disappearing, which is kind of annoying.
It seems like the way to solve the problem would be to set the CREATE_NO_WINDOW flag and I saw there was a PR #7 for that reason.
Is there a way to specify that flag with the current library API?

@hniksic
Copy link
Owner

hniksic commented May 9, 2020

There is currently no support for CREATE_NO_WINDOW. #7 had issues and was apparently abandoned by the reporter.

The way to avoid the console window is to fix the command that requests it. It is my understanding that the console window is requested by the process you're starting, not by subprocess or equivalent API. If you were to start a GUI program, the console wouldn't flash.

Having said that, it definitely sounds useful to be able to optionally suppress the console window when starting executables you can't modify. A PR that does that correctly would be accepted, it's just not trivial because the APIs to do so are poorly documented.

@federico-terzi
Copy link
Author

@hniksic Thank you for the reply and the explanation.

I'll experiment a bit and see if I can get it to work. If successful, I'll open a PR as you suggested.

Thanks again

@hniksic
Copy link
Owner

hniksic commented Sep 15, 2020

Closing due to lack of activity. @federico-terzi please reopen (or create a PR) if you find a way to do this.

@hniksic hniksic closed this as completed Sep 15, 2020
@federico-terzi
Copy link
Author

Thank you @hniksic. Sorry for the lack of response! In the end, the problem was indeed in my program as you suggested and I was able to solve it with these steps: espanso/espanso#249 (comment)

Hope this will help anyone suffering from the same issue :)

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

No branches or pull requests

2 participants