Skip to content

Commit ebca5fc

Browse files
committed
fix(package-manager): fix ternary syntax error in executor.ts spawn chain
The .on() call was incorrectly placed inside each branch of the ternary operator instead of being chained after the ternary resolves to a ChildProcess instance. Wrap the ternary in parentheses and chain .on() outside so it applies to whichever spawn() call was selected. Fixes syntax error identified in #32892 review.
1 parent d89a6f5 commit ebca5fc

File tree

1 file changed

+9
-7
lines changed
  • packages/angular_devkit/schematics/tasks/package-manager

1 file changed

+9
-7
lines changed

packages/angular_devkit/schematics/tasks/package-manager/executor.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,15 @@ export default function (
136136
// Node.js then controls quoting — metacharacters in args are never
137137
// interpreted by cmd.exe as shell operators.
138138
const isWin32 = process.platform === 'win32';
139-
const childProcess = isWin32
140-
? spawn(
141-
'cmd.exe',
142-
['/d', '/s', '/c', taskPackageManagerName, ...args],
143-
{ ...spawnOptions, shell: false },
144-
).on(
145-
: spawn(taskPackageManagerName, args, { ...spawnOptions, shell: false }).on(
139+
const childProcess = (
140+
isWin32
141+
? spawn(
142+
'cmd.exe',
143+
['/d', '/s', '/c', taskPackageManagerName, ...args],
144+
{ ...spawnOptions, shell: false },
145+
)
146+
: spawn(taskPackageManagerName, args, { ...spawnOptions, shell: false })
147+
).on(
146148
'close',
147149
(code: number) => {
148150
if (code === 0) {

0 commit comments

Comments
 (0)