Skip to content

fix: when running in a headless process in win32 the lack of process.… #4871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 22, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion packages/@angular/cli/bin/ng
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const resolve = require('resolve');
const stripIndents = require('common-tags').stripIndents;
const yellow = require('chalk').yellow;
const SemVer = require('semver').SemVer;
const events = require('events');


function _fromPackageJson(cwd) {
Expand Down Expand Up @@ -132,9 +133,20 @@ resolve('@angular/cli', { basedir: process.cwd() },
cli = cli['default'];
}

let standardInput;
if (process.platform === 'win32') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this check is an error; don't you want to set it to process.input on linux/mac?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct, this is residual from a different approach I had to start with. I'll remove the incorrect check for the platform, thanks.

try {
standardInput = process.stdin;
} catch (e) {
delete process.stdin;
process.stdin = new events.EventEmitter();
standardInput = process.stdin;
}
}

cli({
cliArgs: process.argv.slice(2),
inputStream: process.stdin,
inputStream: standardInput,
outputStream: process.stdout
}).then(function (result) {
process.exit(typeof result === 'object' ? result.exitCode : result);
Expand Down