mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
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>
15 lines
450 B
JavaScript
15 lines
450 B
JavaScript
'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}`);
|