hexo icon indicating copy to clipboard operation
hexo copied to clipboard

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

Open hv0905 opened this issue 2 years ago • 2 comments

Check List

Please check followings before submitting a new feature request.

  • [x] I have already read Docs page
  • [x] 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

hv0905 avatar Aug 06 '23 12:08 hv0905

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

stevenjoezhang avatar Aug 08 '23 01:08 stevenjoezhang

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?

hv0905 avatar Aug 08 '23 15:08 hv0905