@@ -16,7 +16,7 @@ const nodeBinary = process.argv[0];
16
16
const preloadOption = ( preloads ) => {
17
17
let option = '' ;
18
18
preloads . forEach ( function ( preload , index ) {
19
- option += `-r ${ preload } ` ;
19
+ option += `-r " ${ preload } " ` ;
20
20
} ) ;
21
21
return option ;
22
22
} ;
@@ -30,15 +30,15 @@ const fixtureD = fixture('define-global.js');
30
30
const fixtureThrows = fixture ( 'throws_error4.js' ) ;
31
31
32
32
// test preloading a single module works
33
- childProcess . exec ( `${ nodeBinary } ${ preloadOption ( [ fixtureA ] ) } ${ fixtureB } ` ,
33
+ childProcess . exec ( `" ${ nodeBinary } " ${ preloadOption ( [ fixtureA ] ) } " ${ fixtureB } " ` ,
34
34
function ( err , stdout , stderr ) {
35
35
assert . ifError ( err ) ;
36
36
assert . strictEqual ( stdout , 'A\nB\n' ) ;
37
37
} ) ;
38
38
39
39
// test preloading multiple modules works
40
40
childProcess . exec (
41
- `${ nodeBinary } ${ preloadOption ( [ fixtureA , fixtureB ] ) } ${ fixtureC } ` ,
41
+ `" ${ nodeBinary } " ${ preloadOption ( [ fixtureA , fixtureB ] ) } " ${ fixtureC } " ` ,
42
42
function ( err , stdout , stderr ) {
43
43
assert . ifError ( err ) ;
44
44
assert . strictEqual ( stdout , 'A\nB\nC\n' ) ;
@@ -47,7 +47,7 @@ childProcess.exec(
47
47
48
48
// test that preloading a throwing module aborts
49
49
childProcess . exec (
50
- `${ nodeBinary } ${ preloadOption ( [ fixtureA , fixtureThrows ] ) } ${ fixtureB } ` ,
50
+ `" ${ nodeBinary } " ${ preloadOption ( [ fixtureA , fixtureThrows ] ) } " ${ fixtureB } " ` ,
51
51
function ( err , stdout , stderr ) {
52
52
if ( err ) {
53
53
assert . strictEqual ( stdout , 'A\n' ) ;
@@ -59,7 +59,7 @@ childProcess.exec(
59
59
60
60
// test that preload can be used with --eval
61
61
childProcess . exec (
62
- `${ nodeBinary } ${ preloadOption ( [ fixtureA ] ) } -e "console.log('hello');"` ,
62
+ `" ${ nodeBinary } " ${ preloadOption ( [ fixtureA ] ) } -e "console.log('hello');"` ,
63
63
function ( err , stdout , stderr ) {
64
64
assert . ifError ( err ) ;
65
65
assert . strictEqual ( stdout , 'A\nhello\n' ) ;
@@ -105,7 +105,7 @@ replProc.on('close', function(code) {
105
105
// test that preload placement at other points in the cmdline
106
106
// also test that duplicated preload only gets loaded once
107
107
childProcess . exec (
108
- `${ nodeBinary } ${ preloadOption ( [ fixtureA ] ) } -e "console.log('hello');" ${
108
+ `" ${ nodeBinary } " ${ preloadOption ( [ fixtureA ] ) } -e "console.log('hello');" ${
109
109
preloadOption ( [ fixtureA , fixtureB ] ) } `,
110
110
function ( err , stdout , stderr ) {
111
111
assert . ifError ( err ) ;
@@ -115,7 +115,7 @@ childProcess.exec(
115
115
116
116
// test that preload works with -i
117
117
const interactive = childProcess . exec (
118
- `${ nodeBinary } ${ preloadOption ( [ fixtureD ] ) } -i` ,
118
+ `" ${ nodeBinary } " ${ preloadOption ( [ fixtureD ] ) } -i` ,
119
119
common . mustCall ( function ( err , stdout , stderr ) {
120
120
assert . ifError ( err ) ;
121
121
assert . strictEqual ( stdout , "> 'test'\n> " ) ;
@@ -126,8 +126,8 @@ interactive.stdin.write('a\n');
126
126
interactive . stdin . write ( 'process.exit()\n' ) ;
127
127
128
128
childProcess . exec (
129
- `${ nodeBinary } --require ${ fixture ( 'cluster-preload.js' ) } ${
130
- fixture ( 'cluster-preload-test.js' ) } `,
129
+ `" ${ nodeBinary } " --require " ${ fixture ( 'cluster-preload.js' ) } " " ${
130
+ fixture ( 'cluster-preload-test.js' ) } " `,
131
131
function ( err , stdout , stderr ) {
132
132
assert . ifError ( err ) ;
133
133
assert . ok ( / w o r k e r t e r m i n a t e d w i t h c o d e 4 3 / . test ( stdout ) ) ;
@@ -137,8 +137,8 @@ childProcess.exec(
137
137
// https://github.com/nodejs/node/issues/1691
138
138
process . chdir ( common . fixturesDir ) ;
139
139
childProcess . exec (
140
- `${ nodeBinary } --expose_natives_as=v8natives --require ` +
141
- `${ fixture ( 'cluster-preload.js' ) } cluster-preload-test.js` ,
140
+ `" ${ nodeBinary } " --expose_natives_as=v8natives --require ` +
141
+ `" ${ fixture ( 'cluster-preload.js' ) } " cluster-preload-test.js` ,
142
142
function ( err , stdout , stderr ) {
143
143
assert . ifError ( err ) ;
144
144
assert . ok ( / w o r k e r t e r m i n a t e d w i t h c o d e 4 3 / . test ( stdout ) ) ;
0 commit comments