|
@ -4,7 +4,7 @@ const path = require('path'); |
|
|
const fs = require('fs'); |
|
|
const fs = require('fs'); |
|
|
const assert = require('assert'); |
|
|
const assert = require('assert'); |
|
|
const os = require('os'); |
|
|
const os = require('os'); |
|
|
const child_process = require('child_process'); |
|
|
const { exec, execSync, spawn, spawnSync } = require('child_process'); |
|
|
const stream = require('stream'); |
|
|
const stream = require('stream'); |
|
|
const util = require('util'); |
|
|
const util = require('util'); |
|
|
const Timer = process.binding('timer_wrap').Timer; |
|
|
const Timer = process.binding('timer_wrap').Timer; |
|
@ -121,7 +121,7 @@ Object.defineProperty(exports, 'inFreeBSDJail', { |
|
|
if (inFreeBSDJail !== null) return inFreeBSDJail; |
|
|
if (inFreeBSDJail !== null) return inFreeBSDJail; |
|
|
|
|
|
|
|
|
if (exports.isFreeBSD && |
|
|
if (exports.isFreeBSD && |
|
|
child_process.execSync('sysctl -n security.jail.jailed').toString() === |
|
|
execSync('sysctl -n security.jail.jailed').toString() === |
|
|
'1\n') { |
|
|
'1\n') { |
|
|
inFreeBSDJail = true; |
|
|
inFreeBSDJail = true; |
|
|
} else { |
|
|
} else { |
|
@ -168,7 +168,7 @@ Object.defineProperty(exports, 'opensslCli', {get: function() { |
|
|
|
|
|
|
|
|
if (exports.isWindows) opensslCli += '.exe'; |
|
|
if (exports.isWindows) opensslCli += '.exe'; |
|
|
|
|
|
|
|
|
const opensslCmd = child_process.spawnSync(opensslCli, ['version']); |
|
|
const opensslCmd = spawnSync(opensslCli, ['version']); |
|
|
if (opensslCmd.status !== 0 || opensslCmd.error !== undefined) { |
|
|
if (opensslCmd.status !== 0 || opensslCmd.error !== undefined) { |
|
|
// openssl command cannot be executed
|
|
|
// openssl command cannot be executed
|
|
|
opensslCli = false; |
|
|
opensslCli = false; |
|
@ -219,7 +219,7 @@ exports.childShouldThrowAndAbort = function() { |
|
|
} |
|
|
} |
|
|
testCmd += `"${process.argv[0]}" --abort-on-uncaught-exception `; |
|
|
testCmd += `"${process.argv[0]}" --abort-on-uncaught-exception `; |
|
|
testCmd += `"${process.argv[1]}" child`; |
|
|
testCmd += `"${process.argv[1]}" child`; |
|
|
const child = child_process.exec(testCmd); |
|
|
const child = exec(testCmd); |
|
|
child.on('exit', function onExit(exitCode, signal) { |
|
|
child.on('exit', function onExit(exitCode, signal) { |
|
|
const errMsg = 'Test should have aborted ' + |
|
|
const errMsg = 'Test should have aborted ' + |
|
|
`but instead exited with exit code ${exitCode}` + |
|
|
`but instead exited with exit code ${exitCode}` + |
|
@ -239,8 +239,6 @@ exports.ddCommand = function(filename, kilobytes) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.spawnCat = function(options) { |
|
|
exports.spawnCat = function(options) { |
|
|
const spawn = require('child_process').spawn; |
|
|
|
|
|
|
|
|
|
|
|
if (exports.isWindows) { |
|
|
if (exports.isWindows) { |
|
|
return spawn('more', [], options); |
|
|
return spawn('more', [], options); |
|
|
} else { |
|
|
} else { |
|
@ -250,8 +248,6 @@ exports.spawnCat = function(options) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.spawnSyncCat = function(options) { |
|
|
exports.spawnSyncCat = function(options) { |
|
|
const spawnSync = require('child_process').spawnSync; |
|
|
|
|
|
|
|
|
|
|
|
if (exports.isWindows) { |
|
|
if (exports.isWindows) { |
|
|
return spawnSync('more', [], options); |
|
|
return spawnSync('more', [], options); |
|
|
} else { |
|
|
} else { |
|
@ -261,8 +257,6 @@ exports.spawnSyncCat = function(options) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.spawnPwd = function(options) { |
|
|
exports.spawnPwd = function(options) { |
|
|
const spawn = require('child_process').spawn; |
|
|
|
|
|
|
|
|
|
|
|
if (exports.isWindows) { |
|
|
if (exports.isWindows) { |
|
|
return spawn('cmd.exe', ['/c', 'cd'], options); |
|
|
return spawn('cmd.exe', ['/c', 'cd'], options); |
|
|
} else { |
|
|
} else { |
|
@ -272,8 +266,6 @@ exports.spawnPwd = function(options) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.spawnSyncPwd = function(options) { |
|
|
exports.spawnSyncPwd = function(options) { |
|
|
const spawnSync = require('child_process').spawnSync; |
|
|
|
|
|
|
|
|
|
|
|
if (exports.isWindows) { |
|
|
if (exports.isWindows) { |
|
|
return spawnSync('cmd.exe', ['/c', 'cd'], options); |
|
|
return spawnSync('cmd.exe', ['/c', 'cd'], options); |
|
|
} else { |
|
|
} else { |
|
|