Skip to content

Commit ff62ead

Browse files
zjm-metameta-codesync[bot]
authored andcommitted
fix(create) Add 'shell:true' to the spawn command to fix Windows CLI dependency installation.
Summary: As user reported in github issue T242207041, IWSDK CLI creation flow would fail on Windows when installing dependency packages. Fixing this issue by adding 'shell:true' to the spawn command. Reviewed By: felixtrz Differential Revision: D87838586 fbshipit-source-id: 4ca62fdbaaf94d18818f69fb5c6847356a805067
1 parent d1d6e19 commit ff62ead

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

packages/create/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
},
3838
"dependencies": {
3939
"@pmndrs/chef": "^0.1.9",
40+
"cross-spawn": "^7.0.6",
4041
"chalk": "^5.6.2",
4142
"commander": "^14.0.0",
4243
"semver": "^7.6.3",
@@ -46,6 +47,7 @@
4647
},
4748
"devDependencies": {
4849
"@types/prompts": "^2.4.9",
49-
"@types/semver": "^7.5.8"
50+
"@types/semver": "^7.5.8",
51+
"@types/cross-spawn": "^6.0.6"
5052
}
5153
}

packages/create/src/installer.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
import { spawn } from 'child_process';
8+
import { spawn } from 'cross-spawn';
99
import { Chalk } from 'chalk';
1010
import ora, { Ora } from 'ora';
1111
import type { ActionItem } from './types.js';
@@ -24,7 +24,10 @@ export async function installDependencies(outDir: string) {
2424
const args = ['install'];
2525
const cmd = 'npm';
2626
try {
27-
const child = spawn(cmd, args, { cwd: outDir, stdio: 'inherit' });
27+
const child = spawn(cmd, args, {
28+
cwd: outDir,
29+
stdio: 'inherit',
30+
});
2831
await new Promise<void>((resolve, reject) => {
2932
child.on('exit', (code) =>
3033
code === 0 ? resolve() : reject(new Error(`Install failed (${code})`)),

pnpm-lock.yaml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)