2018-12-09 09:44:44 -08:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const common = require('../common');
|
|
|
|
const assert = require('assert');
|
|
|
|
const { exec } = require('child_process');
|
|
|
|
|
2019-01-21 01:22:27 +01:00
|
|
|
// Should throw if -c and -e flags are both passed
|
2018-12-09 09:44:44 -08:00
|
|
|
['-c', '--check'].forEach(function(checkFlag) {
|
|
|
|
['-e', '--eval'].forEach(function(evalFlag) {
|
2024-09-29 22:44:52 +02:00
|
|
|
exec(...common.escapePOSIXShell`"${process.execPath}" ${checkFlag} ${evalFlag} foo`, common.mustCall((err, stdout, stderr) => {
|
2018-12-09 09:44:44 -08:00
|
|
|
assert.strictEqual(err instanceof Error, true);
|
|
|
|
assert.strictEqual(err.code, 9);
|
|
|
|
assert(
|
|
|
|
stderr.startsWith(
|
2024-09-22 15:03:30 +02:00
|
|
|
`${process.execPath}: either --check or --eval can be used, not both`
|
2018-12-09 09:44:44 -08:00
|
|
|
)
|
|
|
|
);
|
|
|
|
}));
|
|
|
|
});
|
|
|
|
});
|