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

Hexo should return a non-zero exit code if any error occurred in the generate progress. #5265

Open
2 tasks done
hv0905 opened this issue Aug 6, 2023 · 2 comments
Open
2 tasks done

Comments

@hv0905
Copy link

hv0905 commented Aug 6, 2023

Check List

Please check followings before submitting a new feature request.

  • I have already read Docs page
  • I have already searched existing issues

Feature Request

I've just use a automatic pipeline for building and deploying my blog.

One day I finish my writing and make a git push. However, the build stage failed because of a random network/npm error:

image

Although this was a minor error that could have been resolved through a retry, the issue was exacerbated by the fact that the command hexo g exited with an exit code of 0. Consequently, the pipeline worker assumed that the build had succeeded, leading to the omission of a warning email to my mailbox.

image

To make the thing even worse, the deploy job is just after the build job, so the worker copied all the buggy file to my production environment and broke my production environment.

I hope hexo can exit with a non-zero code when some error occurred, so the deployment job can be cancelled, and warning mail by ci can be sent.

Others

@stevenjoezhang
Copy link
Member

You can try to override hexo.log.error function, to make it terminate the process with non-zero exit code.

@hv0905
Copy link
Author

hv0905 commented Aug 8, 2023

You can try to override hexo.log.error function, to make it terminate the process with non-zero exit code.

What about adding a switch (such as --strict) to terminate the process whenever an error log was printed?

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

No branches or pull requests

2 participants