How to use the os.type function in os

To help you get started, we’ve selected a few os 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 iarna / has-unicode / index.js View on Github external
var hasUnicode = module.exports = function () {
  // Recent Win32 platforms (>XP) CAN support unicode in the console but
  // don't have to, and in non-english locales often use traditional local
  // code pages. There's no way, short of windows system calls or execing
  // the chcp command line program to figure this out. As such, we default
  // this to false and encourage your users to override it via config if
  // appropriate.
  if (os.type() == "Windows_NT") { return false }

  var isUTF8 = /UTF-?8$/i
  var ctype = process.env.LC_ALL || process.env.LC_CTYPE || process.env.LANG
  return isUTF8.test(ctype)
}
github MobileChromeApps / mobile-chrome-apps / node_modules / cordova / node_modules / npm / lib / utils / error-handler.js View on Github external
default:
    log.error("", er.stack || er.message || er)
    log.error("", ["If you need help, you may report this log at:"
                  ,"    "
                  ,"or email it to:"
                  ,"    "
                  ].join("\n"))
    printStack = false
    break
  }

  var os = require("os")
  // just a line break
  console.error("")
  log.error("System", os.type() + " " + os.release())
  log.error("command", process.argv
            .map(JSON.stringify).join(" "))
  log.error("cwd", process.cwd())
  log.error("node -v", process.version)
  log.error("npm -v", npm.version)

  ; [ "file"
    , "path"
    , "type"
    , "syscall"
    , "fstream_path"
    , "fstream_unc_path"
    , "fstream_type"
    , "fstream_class"
    , "fstream_finish_call"
    , "fstream_linkpath"
github alan-ai / alan-sdk-reactnative / testtools / node_modules / node-notifier / notifiers / notifysend.js View on Github external
throw new TypeError(
      'The second argument must be a function callback. You have passed ' +
        typeof callback
    );
  }

  if (typeof options === 'string') {
    options = { title: 'node-notifier', message: options };
  }

  if (!options.message) {
    callback(new Error('Message is required.'));
    return this;
  }

  if (os.type() !== 'Linux' && !os.type().match(/BSD$/)) {
    callback(new Error('Only supported on Linux and *BSD systems'));
    return this;
  }

  if (hasNotifier === false) {
    callback(new Error('notify-send must be installed on the system.'));
    return this;
  }

  if (hasNotifier || !!this.options.suppressOsdCheck) {
    doNotification(options, callback);
    return this;
  }

  try {
    hasNotifier = !!which.sync(notifier);
github ranjithprabhuk / ng2-Dashboard / node_modules / typings / dist / support / cli.js View on Github external
function handleError(error, options) {
    var cause = error.cause;
    logError(error.message, 'message');
    while (cause) {
        logError(cause.message, 'caused by');
        cause = cause.cause;
    }
    if (options.verbose && error.stack) {
        log('');
        logError(error.stack, 'stack');
    }
    log('');
    logError(process.cwd(), 'cwd');
    logError(os.type() + " " + os.release(), 'system');
    logError(process.argv.map(JSON.stringify).join(' '), 'command');
    logError(process.version, 'node -v');
    logError(pkg.version, "typings -v");
    if (error.code) {
        logError(error.code, 'code');
    }
    log('');
    logError('If you need help, you may report this error at:');
    logError("  ");
    process.exit(1);
}
exports.handleError = handleError;
github Tencent / LuaPanda / src / code / server / codeTools.ts View on Github external
export function pathToUri(pathStr : string): string{
	let retUri;
	if (os.type() == "Windows_NT") {
		let pathArr = pathStr.split( path.sep );
		let stdPath = pathArr.join('/');
		retUri = 'file:///' + stdPath;
	}
	else{
		//Darwin
		retUri = 'file://' + pathStr;
	}

	return retUri;
}
github kamilkisiela / graphql-inspector / packages / data / src / extension / agent.ts View on Github external
debug: false,
      minTimeout: 200,
      maxRetries: 5,
      sendImmediately: false,
      sendInterval: 10000,
      maxSize: 25,
      transformError: error => error,
      ...options,
    };

    this.schemaHash = hashSchema(options.schema);

    this.metadata = {
      agent: `1.2.3`,
      runtime: `node ${process.version}`,
      uname: `${os.platform()}, ${os.type()}, ${os.release()}, ${os.arch()}`,
      hostname: os.hostname(),
      schemaHash: this.schemaHash,
      schemaTag: this.options.tag,
    };

    this.report = {
      metadata: this.metadata,
      traces: [],
    };

    if (!this.options.sendImmediately) {
      this.intervalID = setInterval(() => {
        this.send().catch(e => {
          console.error(e);
        });
      }, this.options.sendInterval);
github noobaa / noobaa-core / src / util / os_utils.js View on Github external
function read_drives() {
    if (os.type() === 'Windows_NT') {
        return read_windows_drives();
    } else {
        return read_mac_linux_drives();
    }
}
github Azure / k8s-actions / setup-kubectl / src / run.ts View on Github external
function getExecutableExtension(): string {
    if (os.type().match(/^Win/)) {
        return '.exe';
    }
    return '';
}
github CircuitMess / CircuitBlocks / core / compiler / installer.ts View on Github external
private downloadCli(callback: (string, error) => void) {
    const dlDir = util.tmpdir('cb-cli-dl');
	let arch = os.arch();
	if(arch == "ia32") arch = "x32";
    const plat = os.type() + (os.type() !== 'Darwin' ? "_" + arch : '');
    const url: string = this.downloads.arduino_cli[plat];

    util
      .download(url, dlDir)
      .then((file) => {
        callback(file, null);
      })
      .catch((err) => {
        callback(null, err);
      });
  }
github irccloud / irccloud-desktop / app / crash_reporter.js View on Github external
let config_promise = new Promise((resolve, reject) => {
    let config = {
      release: app.getVersion(),
      environment: is.dev() ? 'development' : 'production',
      name: osName(),
      tags: {
        os_arch: os.arch(),
        os_platform: os.platform(),
        os_release: os.release(),
        os_version: process.getSystemVersion(),
        os_type: os.type(),
        os_totalmem: os_totalmem_gb + 'GB',
        hostname: app.config.get('host'),
        user_style: app.config.get('acceptUserStyles'),
        user_script: app.config.get('acceptUserScripts'),
        tray: app.config.get('tray'),
        menu_bar: app.config.get('menu-bar')
      },
      dataCallback: (data) => {
        if (user) {
          data.user = {
            id: user.id,
            name: user.name,
            email: user.email
          };
        }
        let os_freemem = os.freemem() / 1024 / 1024;