Skip to content

Commit 0ebefa6

Browse files
authored
Health check code doesn't handle paths with spaces (#8625)
* Better handle spaces in project path * Change files
1 parent 5dbd74b commit 0ebefa6

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Better handle spaces in project path",
4+
"packageName": "@react-native-windows/cli",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

packages/@react-native-windows/cli/src/healthChecks.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function getHealthChecks(): HealthCheckCategory[] | undefined {
1919
'react-native-windows/package.json',
2020
{paths: [process.cwd()]})), 'Scripts/rnw-dependencies.ps1');
2121

22-
const rnwDeps = execSync(`powershell -ExecutionPolicy Unrestricted -NoProfile ${rnwDepScriptPath} -NoPrompt -ListChecks`);
22+
const rnwDeps = execSync(`powershell -ExecutionPolicy Unrestricted -NoProfile "${rnwDepScriptPath}" -NoPrompt -ListChecks`);
2323
const deps = rnwDeps.toString().trim().split('\n');
2424
return [
2525
{
@@ -39,7 +39,7 @@ export function getHealthChecks(): HealthCheckCategory[] | undefined {
3939
getDiagnostics: async () => {
4040
let needsToBeFixed = true;
4141
try {
42-
await execa(`powershell -ExecutionPolicy Unrestricted -NoProfile ${rnwDepScriptPath} -NoPrompt -Check ${id}`);
42+
await execa(`powershell -ExecutionPolicy Unrestricted -NoProfile "${rnwDepScriptPath}" -NoPrompt -Check ${id}`);
4343
needsToBeFixed = false;
4444
} catch {
4545
}
@@ -48,7 +48,7 @@ export function getHealthChecks(): HealthCheckCategory[] | undefined {
4848
}
4949
},
5050
runAutomaticFix: async ({ loader, logManualInstallation }) => {
51-
const command = `powershell -ExecutionPolicy Unrestricted -NoProfile ${rnwDepScriptPath} -Check ${id}`;
51+
const command = `powershell -ExecutionPolicy Unrestricted -NoProfile "${rnwDepScriptPath}" -Check ${id}`;
5252
try {
5353
const { exitCode } = await execa(command, { stdio: 'inherit' });
5454
if (exitCode) {

0 commit comments

Comments
 (0)