Skip to content

process.on('exit', ... always errors #22

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
anishkny opened this issue Apr 21, 2019 · 5 comments
Closed

process.on('exit', ... always errors #22

anishkny opened this issue Apr 21, 2019 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@anishkny
Copy link

Doesn't the following line mean that the process will always end in an error?

logAndSendError(new Error(`Process exited with code ${code}`), latestRes);

What is the non-error-producing recommended way to stop the server? Say after testing in a CI environment?

@grant
Copy link
Contributor

grant commented May 20, 2019

That's a good question.
I don't think there is a great way to stop the server now without an error.

Do you have a recommendation for what could fix this? Simply removing the error?

@grant
Copy link
Contributor

grant commented Jul 8, 2019

I think we'd need to change the hander to return 0 and not call logAndSendError.

@grant grant added the bug Something isn't working label Jul 8, 2019
@anishkny
Copy link
Author

anishkny commented Jul 8, 2019

Hey sorry had forgotten about this. Something like this would be very useful:

npx @google-cloud/functions-framework --run-script "./test-my-api.sh"

This should spin up the API and then run test-my-api.sh (or whatever) and when the script is done, quit the API and marshal back the exit code for CI.

@chrisLeeTW
Copy link

@grant I thinks this is very good and simple and elegant solutions for this problem.

@grant
Copy link
Contributor

grant commented Aug 5, 2020

This should be fixed now on master with #187.

@grant grant closed this as completed Aug 5, 2020
@grant grant self-assigned this Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants