Skip to content

Commit c00a045

Browse files
clydinalan-agius4
authored andcommitted
fix(@angular/cli): avoid shell exec when bootstrapping update command
This change removes the usage of the shell execution when spawning the latest CLI version when bootstrapping the update command. The absolute path of the node process is now spawned which removes the need for any shell path resolution. This also removes the need to quote and/or escape command arguments which can be error-prone. Node.js and the OS will now handle any quoting and escaping automatically and without any custom logic. (cherry picked from commit 0978ff5)
1 parent c2c21ed commit c00a045

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

packages/angular/cli/utilities/install-package.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,8 @@ export async function runTempPackageBin(
204204
throw new Error(`Cannot locate bin for temporary package: ${packageNameNoVersion}.`);
205205
}
206206

207-
const argv = [`"${binPath}"`, ...args];
208-
209-
const { status, error } = spawnSync('node', argv, {
207+
const { status, error } = spawnSync(process.execPath, [binPath, ...args], {
210208
stdio: 'inherit',
211-
shell: true,
212209
env: {
213210
...process.env,
214211
NG_DISABLE_VERSION_CHECK: 'true',

0 commit comments

Comments
 (0)