File tree 2 files changed +9
-4
lines changed
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -63,14 +63,20 @@ const makeSpawnArgs = options => {
63
63
64
64
scriptFile = resolve ( tmpdir ( ) , `${ event } -${ Date . now ( ) } .cmd` )
65
65
script += '@echo off\n'
66
- script += `${ cmd } ${ args . map ( ( arg ) => escape . cmd ( arg , doubleEscape ) ) . join ( ' ' ) } `
66
+ script += cmd
67
+ if ( args . length ) {
68
+ script += ` ${ args . map ( ( arg ) => escape . cmd ( arg , doubleEscape ) ) . join ( ' ' ) } `
69
+ }
67
70
} else {
68
71
const shebang = isAbsolute ( scriptShell )
69
72
? `#!${ scriptShell } `
70
73
: `#!/usr/bin/env ${ scriptShell } `
71
74
scriptFile = resolve ( tmpdir ( ) , `${ event } -${ Date . now ( ) } .sh` )
72
75
script += `${ shebang } \n`
73
- script += `${ cmd } ${ args . map ( ( arg ) => escape . sh ( arg ) ) . join ( ' ' ) } `
76
+ script += cmd
77
+ if ( args . length ) {
78
+ script += ` ${ args . map ( ( arg ) => escape . sh ( arg ) ) . join ( ' ' ) } `
79
+ }
74
80
}
75
81
76
82
writeFile ( scriptFile , script )
Original file line number Diff line number Diff line change @@ -82,8 +82,7 @@ if (isWindows) {
82
82
} , 'got expected options' )
83
83
84
84
const contents = fs . readFileSync ( args [ args . length - 1 ] , { encoding : 'utf8' } )
85
- // the contents will have a trailing space if no args are passed
86
- t . equal ( contents , `@echo off\nscript "quoted parameter"; second command ` )
85
+ t . equal ( contents , `@echo off\nscript "quoted parameter"; second command` )
87
86
t . ok ( fs . existsSync ( args [ args . length - 1 ] ) , 'script file was written' )
88
87
cleanup ( )
89
88
t . not ( fs . existsSync ( args [ args . length - 1 ] ) , 'cleanup removes script file' )
You can’t perform that action at this time.
0 commit comments