tty.js 744 B

12345678910111213141516171819202122
  1. "use strict";
  2. /**
  3. * @license
  4. * Copyright Google LLC 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.dev/license
  8. */
  9. Object.defineProperty(exports, "__esModule", { value: true });
  10. exports.isTTY = isTTY;
  11. function _isTruthy(value) {
  12. // Returns true if value is a string that is anything but 0 or false.
  13. return value !== undefined && value !== '0' && value.toUpperCase() !== 'FALSE';
  14. }
  15. function isTTY() {
  16. // If we force TTY, we always return true.
  17. const force = process.env['NG_FORCE_TTY'];
  18. if (force !== undefined) {
  19. return _isTruthy(force);
  20. }
  21. return !!process.stdout.isTTY && !_isTruthy(process.env['CI']);
  22. }