-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Exit the process after commandline-only invocations #15445
Conversation
@@ -109,7 +109,7 @@ bool WindowEmperor::HandleCommandlineArgs() | |||
if (!res.Message.empty()) | |||
{ | |||
AppHost::s_DisplayMessageBox(res); | |||
ExitThread(res.ExitCode); | |||
ExitProcess(res.ExitCode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you call exit(res.ExitCode)
instead? It'll call any atexit()
handlers first and then call TerminateProcess
instead of ExitProcess
for immediate shutdown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure you want to run all our static deinitializers? ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case I'd call quick_exit()
. The implementation can be found at:
C:\Program Files (x86)\Windows Kits\10\Source\10.0.22621.0\ucrt\startup\exit.cpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also _Exit()
btw, which is another proper C standard function (but I think quick_exit
is the right choice). Using OS primitives here doesn't do us any favors as it breaks app verifier and other debugging tools.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yay~
Yep it's that dumb
Closes #15443