tty.js 744 B

12345678910111213141516171819202122
  1. "use strict";
  2. /**
  3. * @license
  4. * Copyright Google Inc. All Rights Reserved.
  5. *
  6. * Use of this source code is governed by an MIT-style license that can be
  7. * found in the LICENSE file at https://angular.io/license
  8. */
  9. Object.defineProperty(exports, "__esModule", { value: true });
  10. function _isTruthy(value) {
  11. // Returns true if value is a string that is anything but 0 or false.
  12. return value !== undefined && value !== '0' && value.toUpperCase() !== 'FALSE';
  13. }
  14. function isTTY() {
  15. // If we force TTY, we always return true.
  16. const force = process.env['NG_FORCE_TTY'];
  17. if (force !== undefined) {
  18. return _isTruthy(force);
  19. }
  20. return !!process.stdout.isTTY && !_isTruthy(process.env['CI']);
  21. }
  22. exports.isTTY = isTTY;