File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
packages/create-docusaurus/src Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,17 @@ export async function runCommand(
2020 args : string [ ] = [ ] ,
2121 options : SpawnOptions = { } ,
2222) : Promise < number > {
23+ // This does something similar to execa.command()
24+ // we split a string command (with optional args) into command+args
25+ // this way it's compatible with spawn()
26+ const [ realCommand , ...baseArgs ] = command . split ( ' ' ) ;
27+ const allArgs = [ ...baseArgs , ...args ] ;
28+ if ( ! realCommand ) {
29+ throw new Error ( `Invalid command: ${ command } ` ) ;
30+ }
31+
2332 return new Promise < number > ( ( resolve , reject ) => {
24- const p = spawn ( command , args , { stdio : 'inherit ' , ...options } ) ; // ignore
33+ const p = spawn ( realCommand , allArgs , { stdio : 'ignore ' , ...options } ) ;
2534 p . on ( 'error' , reject ) ;
2635 p . on ( 'close' , ( exitCode ) =>
2736 exitCode !== null
You can’t perform that action at this time.
0 commit comments