diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-01-12 20:55:58 +0100 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-01-22 22:53:26 +0100 |
commit | 38ab1e9ade1e473f1c0b7a1e7535d41654506a3d (patch) | |
tree | 9c1843e7472f9c2654c2be0755256267245ec5a9 /test/parallel/test-security-revert-unknown.js | |
parent | 8c9aaacb333a0223243eda9b3551dbf26fdb260a (diff) | |
download | android-node-v8-38ab1e9ade1e473f1c0b7a1e7535d41654506a3d.tar.gz android-node-v8-38ab1e9ade1e473f1c0b7a1e7535d41654506a3d.tar.bz2 android-node-v8-38ab1e9ade1e473f1c0b7a1e7535d41654506a3d.zip |
src: pass along errors from `--security-reverts`
Pass along errors from `Revert()` when a security revert
is unknown (which currently applies to all possible values).
Previously, we would unconditionally call `exit()`, which is
not nice for embedding use cases, and could crash because we
were holding a lock for a mutex in `ProcessGlobalArgs()` that
would be destroyed by calling `exit()`.
Also, add a regression test that makes sure that the process
exits with the right exit code and not a crash.
PR-URL: https://github.com/nodejs/node/pull/25466
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-security-revert-unknown.js')
-rw-r--r-- | test/parallel/test-security-revert-unknown.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/parallel/test-security-revert-unknown.js b/test/parallel/test-security-revert-unknown.js new file mode 100644 index 0000000000..688076ce94 --- /dev/null +++ b/test/parallel/test-security-revert-unknown.js @@ -0,0 +1,14 @@ +'use strict'; +require('../common'); +const assert = require('assert'); +const { spawnSync } = require('child_process'); +const os = require('os'); + +const { signal, status, output } = + spawnSync(process.execPath, ['--security-reverts=not-a-cve']); +assert.strictEqual(signal, null); +assert.strictEqual(status, 12); +assert.strictEqual( + output[2].toString(), + `${process.execPath}: Error: ` + + `Attempt to revert an unknown CVE [not-a-cve]${os.EOL}`); |