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

fix(node): respect process.exitCode when exiting #1628

Closed

Conversation

bartlomieju
Copy link
Member

Closes #1627

node/process.ts Outdated
Comment on lines 221 to 222
super.emit("exit", process.exitCode);
Deno.exit(process.exitCode || 0);
Copy link
Member Author

Choose a reason for hiding this comment

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

This is probably wrong - if there are more "unload" listeners attached they will never be run. Opened the PR to get discussion going.

Copy link
Member Author

Choose a reason for hiding this comment

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

@bnoordhuis any ideas how we tackle that except adding functionality equivalent to process.exitCode directly into CLI?

Copy link
Member

Choose a reason for hiding this comment

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

This is probably wrong - if there are more "unload" listeners attached they will never be run. Opened the PR to get discussion going.

I have pushed a fix for this to the PR.

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@lucacasonato lucacasonato left a comment

Choose a reason for hiding this comment

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

This PR is blocked on denoland/deno#12888. This PR falsely makes it look like tests that fail actually succeed, because all deno test isolates exit with code 0 if they import std/node/process.ts anywhere now.

@bartlomieju
Copy link
Member Author

@bnoordhuis actually I was mistaken during the call, this PR is not yet ready.

@bartlomieju
Copy link
Member Author

This should now work properly, however we should probably wait until denoland/deno#12938 is merged before merging this one.

@iuioiua
Copy link
Contributor

iuioiua commented Nov 7, 2022

@bartlomieju, denoland/deno#12938 was cancelled. Is this PR still valid?

@iuioiua
Copy link
Contributor

iuioiua commented Nov 13, 2022

Gently pinging @kt3k.

@iuioiua
Copy link
Contributor

iuioiua commented Dec 12, 2022

@bartlomieju, this appears to no longer be an issue according to #1627 (comment)

@bartlomieju
Copy link
Member Author

Thanks for checking @iuioiua, closing without a merge.

@bartlomieju bartlomieju deleted the respect_process_exit_code branch December 12, 2022 19:10
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

Successfully merging this pull request may close these issues.

node: process.exitCode is not respected when event loop shuts down
4 participants