@@ -4,7 +4,7 @@ const path = require('path');
4
4
const fs = require ( 'fs' ) ;
5
5
const assert = require ( 'assert' ) ;
6
6
const os = require ( 'os' ) ;
7
- const child_process = require ( 'child_process' ) ;
7
+ const { exec , execSync , spawn , spawnSync } = require ( 'child_process' ) ;
8
8
const stream = require ( 'stream' ) ;
9
9
const util = require ( 'util' ) ;
10
10
const Timer = process . binding ( 'timer_wrap' ) . Timer ;
@@ -121,7 +121,7 @@ Object.defineProperty(exports, 'inFreeBSDJail', {
121
121
if ( inFreeBSDJail !== null ) return inFreeBSDJail ;
122
122
123
123
if ( exports . isFreeBSD &&
124
- child_process . execSync ( 'sysctl -n security.jail.jailed' ) . toString ( ) ===
124
+ execSync ( 'sysctl -n security.jail.jailed' ) . toString ( ) ===
125
125
'1\n' ) {
126
126
inFreeBSDJail = true ;
127
127
} else {
@@ -168,7 +168,7 @@ Object.defineProperty(exports, 'opensslCli', {get: function() {
168
168
169
169
if ( exports . isWindows ) opensslCli += '.exe' ;
170
170
171
- const opensslCmd = child_process . spawnSync ( opensslCli , [ 'version' ] ) ;
171
+ const opensslCmd = spawnSync ( opensslCli , [ 'version' ] ) ;
172
172
if ( opensslCmd . status !== 0 || opensslCmd . error !== undefined ) {
173
173
// openssl command cannot be executed
174
174
opensslCli = false ;
@@ -219,7 +219,7 @@ exports.childShouldThrowAndAbort = function() {
219
219
}
220
220
testCmd += `"${ process . argv [ 0 ] } " --abort-on-uncaught-exception ` ;
221
221
testCmd += `"${ process . argv [ 1 ] } " child` ;
222
- const child = child_process . exec ( testCmd ) ;
222
+ const child = exec ( testCmd ) ;
223
223
child . on ( 'exit' , function onExit ( exitCode , signal ) {
224
224
const errMsg = 'Test should have aborted ' +
225
225
`but instead exited with exit code ${ exitCode } ` +
@@ -239,8 +239,6 @@ exports.ddCommand = function(filename, kilobytes) {
239
239
240
240
241
241
exports . spawnCat = function ( options ) {
242
- const spawn = require ( 'child_process' ) . spawn ;
243
-
244
242
if ( exports . isWindows ) {
245
243
return spawn ( 'more' , [ ] , options ) ;
246
244
} else {
@@ -250,8 +248,6 @@ exports.spawnCat = function(options) {
250
248
251
249
252
250
exports . spawnSyncCat = function ( options ) {
253
- const spawnSync = require ( 'child_process' ) . spawnSync ;
254
-
255
251
if ( exports . isWindows ) {
256
252
return spawnSync ( 'more' , [ ] , options ) ;
257
253
} else {
@@ -261,8 +257,6 @@ exports.spawnSyncCat = function(options) {
261
257
262
258
263
259
exports . spawnPwd = function ( options ) {
264
- const spawn = require ( 'child_process' ) . spawn ;
265
-
266
260
if ( exports . isWindows ) {
267
261
return spawn ( 'cmd.exe' , [ '/c' , 'cd' ] , options ) ;
268
262
} else {
@@ -272,8 +266,6 @@ exports.spawnPwd = function(options) {
272
266
273
267
274
268
exports . spawnSyncPwd = function ( options ) {
275
- const spawnSync = require ( 'child_process' ) . spawnSync ;
276
-
277
269
if ( exports . isWindows ) {
278
270
return spawnSync ( 'cmd.exe' , [ '/c' , 'cd' ] , options ) ;
279
271
} else {
0 commit comments