sifive / duh

👾 Design ∪ Hardware
https://observablehq.com/@drom/duh-intro
Apache License 2.0
72 stars 6 forks source link

DuH Validate Returns Zero Exit Code on Validation Failure #86

Open seldridge opened 3 years ago

seldridge commented 3 years ago

Currently (on my system of Node v12.18.0 and DuH 1.18.2), if you have a duh validate failure, you get a zero exit code with some information about promise rejections being deprecated:

(node:46744) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:46744) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

If duh validate fails, it should return a non-zero exit code (preferably something sane like 1).

I can't speak to how this should be handled, but adding the --unhandled-rejections=strict option inside duh.js' shebang will cause the exit code to change to 1 for me.

seldridge commented 3 years ago

It looks like Node 15 is the first version that will return a non-zero exit code without setting the --unhandled-rejections=strict option.