11/// <reference path="scripts/types/ambient.d.ts" />
2+ /// <reference types="q" />
23
34import * as cp from "child_process" ;
45import * as path from "path" ;
@@ -25,7 +26,7 @@ declare global {
2526 type Promise < T > = Q . Promise < T > ;
2627}
2728import del = require( "del" ) ;
28- import mkdirP = require( "mkdirP " ) ;
29+ import mkdirP = require( "mkdirp " ) ;
2930import minimist = require( "minimist" ) ;
3031import browserify = require( "browserify" ) ;
3132import through2 = require( "through2" ) ;
@@ -67,7 +68,9 @@ const cmdLineOptions = minimist(process.argv.slice(2), {
6768function exec ( cmd : string , args : string [ ] , complete : ( ) => void = ( ( ) => { } ) , error : ( e : any , status : number ) => void = ( ( ) => { } ) ) {
6869 console . log ( `${ cmd } ${ args . join ( " " ) } ` ) ;
6970 // TODO (weswig): Update child_process types to add windowsVerbatimArguments to the type definition
70- const ex = cp . spawn ( isWin ? "cmd" : "/bin/sh" , [ isWin ? "/c" : "-c" , cmd , ...args ] , { stdio : "inherit" , windowsVerbatimArguments : true } as any ) ;
71+ const subshellFlag = isWin ? "/c" : "-c" ;
72+ const command = isWin ? [ cmd , ...args ] : [ `${ cmd } ${ args . join ( " " ) } ` ] ;
73+ const ex = cp . spawn ( isWin ? "cmd" : "/bin/sh" , [ subshellFlag , ...command ] , { stdio : "inherit" , windowsVerbatimArguments : true } as any ) ;
7174 ex . on ( "exit" , ( code ) => code === 0 ? complete ( ) : error ( /*e*/ undefined , code ) ) ;
7275 ex . on ( "error" , error ) ;
7376}
0 commit comments