How to use the tty.isatty function in tty

To help you get started, we’ve selected a few tty examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github enb / enb / lib / ui / colorize.js View on Github external
var tty = require('tty');
var chalk = require('chalk');

var enabled = process.env.COLOR || (!process.env.NOCOLOR && tty.isatty(1) && tty.isatty(2));

module.exports = new chalk.constructor({ enabled: enabled });
github hapijs / lab / lib / output.js View on Github external
internals.color = function (name, code, forceColor) {

    if ((Tty.isatty(1) && Tty.isatty(2)) || forceColor) {
        var color = '\u001b[' + code + 'm';
        return function (text) { return color + text + '\u001b[0m'; };
    }

    return function (text) { return text; };
};
github nicolaspanel / node-svm / lib / core / config.js View on Github external
function readCachedConfig(cwd) {
    if (cachedConfigs[cwd]) { return cachedConfigs[cwd]; }

    var config = cachedConfigs[cwd] = normalise(rc('nodesvm', defaults, cwd));

    if (!_o.has(config, 'interactive')) {
        config.interactive = (process.bin === 'node-svm' && tty.isatty(1) && !process.env.CI);
    }

    return config;
}
function resetCache () {
github apiaryio / api-elements.js / packages / fury-cli / lib / fury.js View on Github external
write(output, json = false) {
    if (this.outputPath) {
      fs.writeFileSync(this.outputPath, output);
    } else if (isatty(process.stdout.fd) && json) {
      const highlighted = highlight(output, { json: true, theme });
      process.stdout.write(highlighted);
    } else {
      process.stdout.write(output);
    }
  }
}
github graalvm / graaljs / deps / npm / lib / search / format-package-stream.js View on Github external
function getMaxWidth () {
  var cols
  try {
    var tty = require('tty')
    var stdout = process.stdout
    cols = !tty.isatty(stdout.fd) ? Infinity : process.stdout.getWindowSize()[0]
    cols = (cols === 0) ? Infinity : cols
  } catch (ex) { cols = Infinity }
  return cols
}
github davidhealey / waistline / node_modules / npm / lib / search.js View on Github external
function getMaxWidth() {
  var cols
  try {
    var tty = require("tty")
      , stdout = process.stdout
    cols = !tty.isatty(stdout.fd) ? Infinity : process.stdout.getWindowSize()[0]
    cols = (cols === 0) ? Infinity : cols
  } catch (ex) { cols = Infinity }
  return cols
}
github feedhenry / fh-fhc / lib / utils / output.js View on Github external
function isatty(stream) {
  if (!tty.isatty) {
    return true;
  }
  if (!stream) {
    return false;
  }
  if (stream.isTTY) {
    return true;
  }
  if (stream && (typeof stream.fd === "number")) {
    stream.isTTY = tty.isatty(stream.fd);
  }
  return stream.isTTY;
}

tty

This package name is not currently in use, but was formerly occupied by another package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.

ISC
Latest version published 8 years ago

Package Health Score

50 / 100
Full package analysis