mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
8a7db9d4b5
The --use-bundled-ca and --use-openssl-ca command line arguments are mutually exclusive but can both be used on the same command line. This commit adds a check if both options are used. Fixes: https://github.com/nodejs/node/issues/12083 PR-URL: https://github.com/nodejs/node/pull/12087 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
32 lines
1.3 KiB
JavaScript
32 lines
1.3 KiB
JavaScript
'use strict';
|
|
// This test checks the usage of --use-bundled-ca and --use-openssl-ca arguments
|
|
// to verify that both are not used at the same time.
|
|
const common = require('../common');
|
|
if (!common.hasCrypto) {
|
|
common.skip('missing crypto');
|
|
return;
|
|
}
|
|
const assert = require('assert');
|
|
const os = require('os');
|
|
const childProcess = require('child_process');
|
|
const result = childProcess.spawnSync(process.execPath, [
|
|
'--use-bundled-ca',
|
|
'--use-openssl-ca',
|
|
'-p', 'process.version'],
|
|
{encoding: 'utf8'});
|
|
|
|
assert.strictEqual(result.stderr,
|
|
process.execPath + ': either --use-openssl-ca or ' +
|
|
'--use-bundled-ca can be used, not both' + os.EOL);
|
|
assert.strictEqual(result.status, 9);
|
|
|
|
const useBundledCA = childProcess.spawnSync(process.execPath, [
|
|
'--use-bundled-ca',
|
|
'-p', 'process.version']);
|
|
assert.strictEqual(useBundledCA.status, 0);
|
|
|
|
const useOpenSSLCA = childProcess.spawnSync(process.execPath, [
|
|
'--use-openssl-ca',
|
|
'-p', 'process.version']);
|
|
assert.strictEqual(useOpenSSLCA.status, 0);
|