@@ -4,7 +4,7 @@ const path = require('path');
44const fs = require ( 'fs' ) ;
55const assert = require ( 'assert' ) ;
66const os = require ( 'os' ) ;
7- const child_process = require ( 'child_process' ) ;
7+ const { exec , execSync , spawn , spawnSync } = require ( 'child_process' ) ;
88const stream = require ( 'stream' ) ;
99const util = require ( 'util' ) ;
1010const Timer = process . binding ( 'timer_wrap' ) . Timer ;
@@ -121,7 +121,7 @@ Object.defineProperty(exports, 'inFreeBSDJail', {
121121 if ( inFreeBSDJail !== null ) return inFreeBSDJail ;
122122
123123 if ( exports . isFreeBSD &&
124- child_process . execSync ( 'sysctl -n security.jail.jailed' ) . toString ( ) ===
124+ execSync ( 'sysctl -n security.jail.jailed' ) . toString ( ) ===
125125 '1\n' ) {
126126 inFreeBSDJail = true ;
127127 } else {
@@ -168,7 +168,7 @@ Object.defineProperty(exports, 'opensslCli', {get: function() {
168168
169169 if ( exports . isWindows ) opensslCli += '.exe' ;
170170
171- const opensslCmd = child_process . spawnSync ( opensslCli , [ 'version' ] ) ;
171+ const opensslCmd = spawnSync ( opensslCli , [ 'version' ] ) ;
172172 if ( opensslCmd . status !== 0 || opensslCmd . error !== undefined ) {
173173 // openssl command cannot be executed
174174 opensslCli = false ;
@@ -219,7 +219,7 @@ exports.childShouldThrowAndAbort = function() {
219219 }
220220 testCmd += `"${ process . argv [ 0 ] } " --abort-on-uncaught-exception ` ;
221221 testCmd += `"${ process . argv [ 1 ] } " child` ;
222- const child = child_process . exec ( testCmd ) ;
222+ const child = exec ( testCmd ) ;
223223 child . on ( 'exit' , function onExit ( exitCode , signal ) {
224224 const errMsg = 'Test should have aborted ' +
225225 `but instead exited with exit code ${ exitCode } ` +
@@ -239,8 +239,6 @@ exports.ddCommand = function(filename, kilobytes) {
239239
240240
241241exports . spawnCat = function ( options ) {
242- const spawn = require ( 'child_process' ) . spawn ;
243-
244242 if ( exports . isWindows ) {
245243 return spawn ( 'more' , [ ] , options ) ;
246244 } else {
@@ -250,8 +248,6 @@ exports.spawnCat = function(options) {
250248
251249
252250exports . spawnSyncCat = function ( options ) {
253- const spawnSync = require ( 'child_process' ) . spawnSync ;
254-
255251 if ( exports . isWindows ) {
256252 return spawnSync ( 'more' , [ ] , options ) ;
257253 } else {
@@ -261,8 +257,6 @@ exports.spawnSyncCat = function(options) {
261257
262258
263259exports . spawnPwd = function ( options ) {
264- const spawn = require ( 'child_process' ) . spawn ;
265-
266260 if ( exports . isWindows ) {
267261 return spawn ( 'cmd.exe' , [ '/c' , 'cd' ] , options ) ;
268262 } else {
@@ -272,8 +266,6 @@ exports.spawnPwd = function(options) {
272266
273267
274268exports . spawnSyncPwd = function ( options ) {
275- const spawnSync = require ( 'child_process' ) . spawnSync ;
276-
277269 if ( exports . isWindows ) {
278270 return spawnSync ( 'cmd.exe' , [ '/c' , 'cd' ] , options ) ;
279271 } else {
0 commit comments