Skip to content

Commit 8adb372

Browse files
clydinhansl
authored andcommitted
fix(@angular/cli): properly bootstrap 1.x from global 6.x
1 parent fb5c001 commit 8adb372

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

packages/angular/cli/lib/init.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { resolve } from '@angular-devkit/core/node';
1313
import * as fs from 'fs';
1414
import * as path from 'path';
1515
import { SemVer } from 'semver';
16+
import { Duplex } from 'stream';
1617
import { isWarningEnabled } from '../utilities/config';
1718

1819
const packageJson = require('../package.json');
@@ -121,7 +122,21 @@ if ('default' in cli) {
121122
cli = cli['default'];
122123
}
123124

124-
cli({ cliArgs: process.argv.slice(2) })
125+
// This is required to support 1.x local versions with a 6+ global
126+
let standardInput;
127+
try {
128+
standardInput = process.stdin;
129+
} catch (e) {
130+
delete process.stdin;
131+
process.stdin = new Duplex();
132+
standardInput = process.stdin;
133+
}
134+
135+
cli({
136+
cliArgs: process.argv.slice(2),
137+
inputStream: standardInput,
138+
outputStream: process.stdout,
139+
})
125140
.then((exitCode: number) => {
126141
process.exit(exitCode);
127142
})

0 commit comments

Comments
 (0)