Skip to content

Commit

Permalink
fix(@angular/cli): ng e2e and ng lint prompt requires to hit Ente…
Browse files Browse the repository at this point in the history
…r twice to go on on Windows

This fixes an issue where prompts in nested child processes on Windows require multiple keystrokes to proceed.

Closes angular#26724
  • Loading branch information
alan-agius4 committed Dec 21, 2023
1 parent 6999c2e commit f0eaf8b
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ import {
WorkspaceNodeModulesArchitectHost,
} from '@angular-devkit/architect/node';
import { json } from '@angular-devkit/core';
import { spawnSync } from 'child_process';
import { existsSync } from 'fs';
import { resolve } from 'path';
import { existsSync } from 'node:fs';
import { resolve } from 'node:path';
import { isPackageNameSafeForAnalytics } from '../analytics/analytics';
import { EventCustomDimension, EventCustomMetric } from '../analytics/analytics-parameters';
import { assertIsError } from '../utilities/error';
Expand Down Expand Up @@ -248,14 +247,14 @@ export abstract class ArchitectBaseCommandModule<T extends object>
const packageToInstall = await this.getMissingTargetPackageToInstall(choices);
if (packageToInstall) {
// Example run: `ng add @angular-eslint/schematics`.
const binPath = resolve(__dirname, '../../bin/ng.js');
const { error } = spawnSync(process.execPath, [binPath, 'add', packageToInstall], {
stdio: 'inherit',
const AddCommadModule = (await import('../commands/add/cli')).default;
await new AddCommadModule(this.context).run({
interactive: true,
force: false,
dryRun: false,
defaults: false,
collection: packageToInstall,
});

if (error) {
throw error;
}
}
} else {
// Non TTY display error message.
Expand Down

0 comments on commit f0eaf8b

Please sign in to comment.