How to use the process.platform function in process

To help you get started, we’ve selected a few process 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 eslint / eslint / tests / lib / cli-engine / formatters / junit.js View on Github external

"use strict";

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------

const assert = require("chai").assert,
    formatter = require("../../../../lib/cli-engine/formatters/junit"),
    process = require("process");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

const suppliedFilePath = (process.platform === "win32") ? "C:\\path\\to\\foo.js" : "/path/to/foo.js";
const expectedClassName = (process.platform === "win32") ? "C:\\path\\to\\foo" : "/path/to/foo";

describe("formatter:junit", () => {
    describe("when there are no problems", () => {
        const code = [];

        it("should not complain about anything", () => {
            const result = formatter(code);

            assert.strictEqual(result.replace(/\n/gu, ""), "");
        });
    });

    describe("when passed a single message", () => {
        const code = [{
            filePath: suppliedFilePath,
github Devine-Davies / vs-make-hidden / src / make-hidden / utilities.ts View on Github external
export function getExtensionSettingPath(): string {
    let projectFile: string;

    const appData = process.env.APPDATA || (process.platform === "darwin" ? process.env.HOME + "/Library/Application Support" : "/var/local");
    const channelPath: string = this.getChannelPath();
    // console.log( appData );

    projectFile = path.join(appData, channelPath, "User", PROJECTS_FILE);
    // in linux, it may not work with /var/local, then try to use /home/myuser/.config
    if ( ( process.platform === "linux" ) && ( ! fs.existsSync( projectFile ) ) ) {
        projectFile = path.join( HOME_DIR, ".config/", channelPath, "User", PROJECTS_FILE );
    }

    return projectFile;
}
github Scintillo / eppabasic / Gruntfile.js View on Github external
var fs = require('fs');
var path = require('path');
var glob = require('glob');
var format = require('string-format');
var ini = require('ini');
var path = require('path');
var process = require('process');
var crypto = require('crypto');

var isWin = /^win/.test(process.platform);

var tracker;
module.exports = function (grunt) {
    require('load-grunt-tasks')(grunt);

    // Settings
    var wwwDir = path.resolve(grunt.option('www') || 'www');
    var tmpDir = path.resolve(grunt.option('tmp') || wwwDir + '/tmp');

    // Config
    var config = new ConfigHandler(grunt, wwwDir, tmpDir);
    config.load();

    // Add targets
    config.addRequirejsTarget('main', ['app', 'ace.build.js', 'editor/main'], wwwDir + '/js/app.js');
    config.addRequirejsTarget('runtime', ['runtime/app', 'runtime/Runtime'], wwwDir + '/js/runtime/app.js');
github mikedeboer / chromeless2 / modules / sdk / child_process.js View on Github external
exports.exec = function() {
  var file, args, options, callback;

  if (typeof arguments[1] === 'function') {
    options = undefined;
    callback = arguments[1];
  } else {
    options = arguments[1];
    callback = arguments[2];
  }

  if (process.platform === 'win32') {
    file = 'cmd.exe';
    args = ['/s', '/c', '"' + command + '"'];
    // Make a shallow copy before patching so we don't clobber the user's
    // options object.
    options = mergeOptions({}, options);
    options.windowsVerbatimArguments = true;
  } else {
    file = '/bin/sh';
    args = ['-c', command];
  }
  return exports.execFile(file, args, options, callback);
};
github balena-io / etcher / lib / gui / app / modules / drive-scanner.js View on Github external
*
 * @example
 * const shouldInclude = includeSystemDrives()
 */
const includeSystemDrives = () => {
  return settings.get('unsafeMode') && !settings.get('disableUnsafeMode')
}

const adapters = [
  new sdk.scanner.adapters.BlockDeviceAdapter(includeSystemDrives)
]

// Can't use permissions.isElevated() here as it returns a promise and we need to set
// module.exports = scanner right now.
// eslint-disable-next-line no-magic-numbers
if ((process.platform !== 'linux') || (process.geteuid() === 0)) {
  adapters.push(new sdk.scanner.adapters.UsbbootDeviceAdapter())
}

if (process.platform === 'win32') {
  adapters.push(new sdk.scanner.adapters.DriverlessDeviceAdapter())
}

const scanner = new sdk.scanner.Scanner(adapters)

module.exports = scanner
github aws / aws-sdk-js-v3 / packages / util-user-agent-node / src / index.spec.ts View on Github external
it("should response basic node default user agent", () => {
    const originEnv = process.env.AWS_EXECUTION_ENV;
    delete process.env.AWS_EXECUTION_ENV;
    expect(defaultUserAgent("client-s3-node", "0.1.0")).toBe(
      `aws-sdk-nodejs-v3-client-s3-node/0.1.0 ${process.platform}/${process.version}`
    );
    if (originEnv) process.env.AWS_EXECUTION_ENV = originEnv;
  });
github mihirpathak97 / audius / src / js / index.js View on Github external
const remote = require('electron').remote;
const platform = require('process').platform;

function loadDisclaimer() {
  const BrowserWindow = remote.BrowserWindow;
  var win = new BrowserWindow({frame:false, width: 800, height: 600, resizable:false});
  win.loadURL('file://' + __dirname + '/disclaimer.html');
}

function minimize() {
  var window = remote.getCurrentWindow();
  window.minimize();
}

function quit() {
  var window = remote.getCurrentWindow();
  window.close();
}
github wtfil / rust-in-node / src / native-rust-ffi.js View on Github external
var ffi = require('ffi');
var process = require('process')

var isWin = /^win/.test(process.platform);

module.exports = ffi.Library('rust/target/release/'+(!isWin?'lib':'')+'embed', {
	fibonacci: ['int', ['int']]
});
github AdobeXD / xdpm / lib / platform.js View on Github external
* you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

const process = require("process");

let platform;
switch(process.platform) {
    case "darwin":
        platform = "mac";
        break;
    case "win32":
        platform = "win";
        break;
    default:
        platform = null;
}

if (!platform) {
    throw new Error("Unsupported platform; run on macOS or Windows.");
}

module.exports = platform;