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

Exit the process after commandline-only invocations #15445

Merged
merged 3 commits into from
May 26, 2023
Merged

Conversation

zadjii-msft
Copy link
Member

Yep it's that dumb

Closes #15443

@microsoft-github-policy-service microsoft-github-policy-service bot added the Issue-Bug It either shouldn't be doing this or needs an investigation. label May 25, 2023
@zadjii-msft zadjii-msft requested review from lhecker and DHowett May 26, 2023 10:08
@@ -109,7 +109,7 @@ bool WindowEmperor::HandleCommandlineArgs()
if (!res.Message.empty())
{
AppHost::s_DisplayMessageBox(res);
ExitThread(res.ExitCode);
ExitProcess(res.ExitCode);
Copy link
Member

@lhecker lhecker May 26, 2023

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.

Copy link
Member

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? ;)

Copy link
Member

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

Copy link
Member

@lhecker lhecker May 26, 2023

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.

Copy link
Member

@lhecker lhecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay~

@DHowett DHowett enabled auto-merge (squash) May 26, 2023 19:24
@DHowett DHowett changed the title ExitProcess for commandline-only invokes Exit the process for commandline-only invokes May 26, 2023
@DHowett DHowett changed the title Exit the process for commandline-only invokes Exit the process after commandline-only invocations May 26, 2023
@DHowett DHowett disabled auto-merge May 26, 2023 19:31
@DHowett DHowett enabled auto-merge (squash) May 26, 2023 19:31
@DHowett DHowett merged commit c9e993a into main May 26, 2023
@DHowett DHowett deleted the dev/migrie/b/15443 branch May 26, 2023 19:59
DHowett pushed a commit that referenced this pull request May 26, 2023
Yep it's that dumb

Closes #15443

(cherry picked from commit c9e993a)
Service-Card-Id: 89327583
Service-Version: 1.18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.
Projects
Development

Successfully merging this pull request may close these issues.

wt --help process never exits
3 participants