|
|
@ -25,11 +25,10 @@ const path = require('path'); |
|
|
|
const fs = require('fs'); |
|
|
|
const assert = require('assert'); |
|
|
|
const os = require('os'); |
|
|
|
const child_process = require('child_process'); |
|
|
|
const { exec, execSync, spawn, spawnSync } = require('child_process'); |
|
|
|
const stream = require('stream'); |
|
|
|
const util = require('util'); |
|
|
|
const Timer = process.binding('timer_wrap').Timer; |
|
|
|
const execSync = require('child_process').execSync; |
|
|
|
|
|
|
|
const testRoot = process.env.NODE_TEST_DIR ? |
|
|
|
fs.realpathSync(process.env.NODE_TEST_DIR) : path.resolve(__dirname, '..'); |
|
|
@ -186,7 +185,7 @@ Object.defineProperty(exports, 'inFreeBSDJail', { |
|
|
|
if (inFreeBSDJail !== null) return inFreeBSDJail; |
|
|
|
|
|
|
|
if (exports.isFreeBSD && |
|
|
|
child_process.execSync('sysctl -n security.jail.jailed').toString() === |
|
|
|
execSync('sysctl -n security.jail.jailed').toString() === |
|
|
|
'1\n') { |
|
|
|
inFreeBSDJail = true; |
|
|
|
} else { |
|
|
@ -233,7 +232,7 @@ Object.defineProperty(exports, 'opensslCli', {get: function() { |
|
|
|
|
|
|
|
if (exports.isWindows) opensslCli += '.exe'; |
|
|
|
|
|
|
|
const opensslCmd = child_process.spawnSync(opensslCli, ['version']); |
|
|
|
const opensslCmd = spawnSync(opensslCli, ['version']); |
|
|
|
if (opensslCmd.status !== 0 || opensslCmd.error !== undefined) { |
|
|
|
// openssl command cannot be executed
|
|
|
|
opensslCli = false; |
|
|
@ -283,7 +282,7 @@ exports.childShouldThrowAndAbort = function() { |
|
|
|
} |
|
|
|
testCmd += `"${process.argv[0]}" --abort-on-uncaught-exception `; |
|
|
|
testCmd += `"${process.argv[1]}" child`; |
|
|
|
const child = child_process.exec(testCmd); |
|
|
|
const child = exec(testCmd); |
|
|
|
child.on('exit', function onExit(exitCode, signal) { |
|
|
|
const errMsg = 'Test should have aborted ' + |
|
|
|
`but instead exited with exit code ${exitCode}` + |
|
|
@ -303,8 +302,6 @@ exports.ddCommand = function(filename, kilobytes) { |
|
|
|
|
|
|
|
|
|
|
|
exports.spawnPwd = function(options) { |
|
|
|
const spawn = require('child_process').spawn; |
|
|
|
|
|
|
|
if (exports.isWindows) { |
|
|
|
return spawn('cmd.exe', ['/d', '/c', 'cd'], options); |
|
|
|
} else { |
|
|
@ -314,8 +311,6 @@ exports.spawnPwd = function(options) { |
|
|
|
|
|
|
|
|
|
|
|
exports.spawnSyncPwd = function(options) { |
|
|
|
const spawnSync = require('child_process').spawnSync; |
|
|
|
|
|
|
|
if (exports.isWindows) { |
|
|
|
return spawnSync('cmd.exe', ['/d', '/c', 'cd'], options); |
|
|
|
} else { |
|
|
@ -789,7 +784,7 @@ exports.getTTYfd = function getTTYfd() { |
|
|
|
else if (!tty.isatty(tty_fd)) tty_fd++; |
|
|
|
else { |
|
|
|
try { |
|
|
|
tty_fd = require('fs').openSync('/dev/tty'); |
|
|
|
tty_fd = fs.openSync('/dev/tty'); |
|
|
|
} catch (e) { |
|
|
|
// There aren't any tty fd's available to use.
|
|
|
|
return -1; |
|
|
|