Ability to set ELECTRON_NO_ATTACH_CONSOLE from app
- Dominant language
- C++
- Stars
- 123k
- Forks
- 17.5k
- Avg merge
- 14h 28m
- Merged PRs (30d)
- 870
Description
### Preflight Checklist
- [x] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/main/CONTRIBUTING.md) for this project.
- [x] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [x] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a feature request that matches the one I want to file, without success.
### Problem Description
I previous post https://github.com/electron/electron/issues/20266 incorrectly posted this as an Issue and not a Feature Request
So here it is!
Im about to launch an Electron app, although i've just discovered that when you run the app from the command line in Windows the terminal session attaches to the log output from the Electron app. You can't quit the terminal session because it will kill the app.
I need my app to be launched on startup of Windows, without having the ugly terminal screen there. I would also like people to be able to script it's start without needing the terminal to stay alive.
I know I can do this with the ELECTRON_NO_ATTACH_CONSOLE env var, but there doesn't seem to be a way to force this to be always on. I don't want to tell people they need to set ELECTRON_NO_ATTACH_CONSOLE=true before running the app, thats ugly.
Using Electron builder to build the production app. Have tried forcing env.ELECTRON_NO_ATTACH_CONSOLE=true at the top of my main file, before anything else loads, but that seems to do nothing.
As far as I can tell, it's not possible right now (really happy if someone can prove me wrong).
### Proposed Solution
Have the ability to configure this option (ELECTRON_NO_ATTACH_CONSOLE) from within the app without the need for environment variable.
### Alternatives Considered
The alternative is to have the user
set ELECTRON_NO_ATTACH_CONSOLE=true in their batch files before running the app
This is not intuitive and I've never seen any other apps besides electron do this.
The end user should not have to make changes for a production app if they use batch files in their workflow.
### Additional Information
It is currently an env variable, if more then one electron app are in the the batch file, then this affects the others as well, so the user must be mindful of which app needs to attach to the console and others that don't.
Contributor guide
Assessment
This issue has not been assessed yet.