Skip to content

Commit 19b494d

Browse files
committed
fix issues
1 parent 525ff03 commit 19b494d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/create-docusaurus/src/utils.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)