Skip to content

fix: do not err on process exit #144

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

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/invoker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ export class ErrorHandler {
logAndSendError(err, latestRes, killInstance);
});

process.on('exit', code => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this would remove error logging when the process exits from user's function.

I do think we should not log and send error when process exits normally though. How about checking the status code and only logAndSendError for non-0 ones? Or handing SIGINT before exit?

logAndSendError(new Error(`Process exited with code ${code}`), latestRes);
process.on('SIGINT', code => {
console.log(`Process exited with code ${code}`);
});

['SIGINT', 'SIGTERM'].forEach(signal => {
Copy link
Contributor

Choose a reason for hiding this comment

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

SIGINT is also handled here. Could you please update this?

Expand Down