Skip to content

Commit a391b5f

Browse files
committed
fix(@angular/cli): ng e2e and ng lint prompt requires to hit Enter twice to proceed on Windows
This fixes an issue where prompts in nested child processes on Windows require multiple keystrokes to proceed. Closes #26724
1 parent 75b6046 commit a391b5f

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

packages/angular/cli/src/command-builder/architect-base-command-module.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ import {
1212
WorkspaceNodeModulesArchitectHost,
1313
} from '@angular-devkit/architect/node';
1414
import { json } from '@angular-devkit/core';
15-
import { spawnSync } from 'child_process';
16-
import { existsSync } from 'fs';
17-
import { resolve } from 'path';
15+
import { existsSync } from 'node:fs';
16+
import { resolve } from 'node:path';
1817
import { isPackageNameSafeForAnalytics } from '../analytics/analytics';
1918
import { EventCustomDimension, EventCustomMetric } from '../analytics/analytics-parameters';
2019
import { assertIsError } from '../utilities/error';
@@ -248,14 +247,14 @@ export abstract class ArchitectBaseCommandModule<T extends object>
248247
const packageToInstall = await this.getMissingTargetPackageToInstall(choices);
249248
if (packageToInstall) {
250249
// Example run: `ng add @angular-eslint/schematics`.
251-
const binPath = resolve(__dirname, '../../bin/ng.js');
252-
const { error } = spawnSync(process.execPath, [binPath, 'add', packageToInstall], {
253-
stdio: 'inherit',
250+
const AddCommandModule = (await import('../commands/add/cli')).default;
251+
await new AddCommandModule(this.context).run({
252+
interactive: true,
253+
force: false,
254+
dryRun: false,
255+
defaults: false,
256+
collection: packageToInstall,
254257
});
255-
256-
if (error) {
257-
throw error;
258-
}
259258
}
260259
} else {
261260
// Non TTY display error message.

packages/angular/cli/src/commands/add/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const packageVersionExclusions: Record<string, string | Range> = {
5555
'@angular/material': '7.x',
5656
};
5757

58-
export default class AddCommadModule
58+
export default class AddCommandModule
5959
extends SchematicsCommandModule
6060
implements CommandModuleImplementation<AddCommandArgs>
6161
{

0 commit comments

Comments
 (0)