@@ -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', {
121121if ( inFreeBSDJail !== null ) return inFreeBSDJail ;
122122
123123if ( exports . isFreeBSD &&
124- child_process . execSync ( 'sysctl -n security.jail.jailed' ) . toString ( ) ===
124+ execSync ( 'sysctl -n security.jail.jailed' ) . toString ( ) ===
125125'1\n' ) {
126126inFreeBSDJail = true ;
127127} else {
@@ -168,7 +168,7 @@ Object.defineProperty(exports, 'opensslCli', {get: function() {
168168
169169if ( exports . isWindows ) opensslCli += '.exe' ;
170170
171- const opensslCmd = child_process . spawnSync ( opensslCli , [ 'version' ] ) ;
171+ const opensslCmd = spawnSync ( opensslCli , [ 'version' ] ) ;
172172if ( opensslCmd . status !== 0 || opensslCmd . error !== undefined ) {
173173// openssl command cannot be executed
174174opensslCli = false ;
@@ -219,7 +219,7 @@ exports.childShouldThrowAndAbort = function() {
219219}
220220testCmd += `"${ process . argv [ 0 ] } " --abort-on-uncaught-exception ` ;
221221testCmd += `"${ process . argv [ 1 ] } " child` ;
222- const child = child_process . exec ( testCmd ) ;
222+ const child = exec ( testCmd ) ;
223223child . on ( 'exit' , function onExit ( exitCode , signal ) {
224224const 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-
244242if ( exports . isWindows ) {
245243return 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-
255251if ( exports . isWindows ) {
256252return 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-
266260if ( exports . isWindows ) {
267261return 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-
277269if ( exports . isWindows ) {
278270return spawnSync ( 'cmd.exe' , [ '/c' , 'cd' ] , options ) ;
279271} else {
0 commit comments