mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-22 15:02:11 +08:00
`stdin` can be redirected/piped by various shells but still be interactive. Node.js recommends only testing `stdout`: https://nodejs.org/api/tty.html#tty_tty Fixes #14640
18 lines
504 B
TypeScript
18 lines
504 B
TypeScript
/**
|
|
* @license
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
export function isTTY(): boolean {
|
|
const force = process.env['NG_FORCE_TTY'];
|
|
if (force !== undefined) {
|
|
return !(force === '0' || force.toUpperCase() === 'FALSE');
|
|
}
|
|
|
|
const ci = process.env['CI'];
|
|
|
|
return !!process.stdout.isTTY && (!ci || ci === '0' || ci.toUpperCase() === 'FALSE');
|
|
}
|