How to use shell-path - 4 common examples

To help you get started, we’ve selected a few shell-path 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 alibaba / ice / packages / iceworks-server / src / lib / plugin / project-manager / app.ts View on Github external
public getEnv() {
    const PATH = pathKey();

    const env = process.env;
    const envPath = shellPath.sync().split(path.delimiter);
    envPath.unshift(path.join(this.path, 'node_modules', '.bin'));

    this.app.logger.info('env.pah:', process.env[PATH]);

    // for electron fallback
    const resourcesPath = process['resourcesPath']; // eslint-disable-line
    if (resourcesPath) {
      envPath.push(path.join(resourcesPath, 'bin'));
    }

    env[PATH] = envPath.join(path.delimiter);

    this.app.logger.info('setEnv.pah:', env[PATH]);

    // reset NODE_ENV
    // in egg.js: Generally, before deploying the application, dependencies will be installed with NODE_ENV=production or --production
github egoist / vue-cli-gui / app / index.js View on Github external
y: lastWindowState.y,
    width: lastWindowState.width,
    height: lastWindowState.height,
    show: false
  })

  win.webContents.on('new-window', (e, url) => {
    e.preventDefault()
    shell.openExternal(url)
  })

  const RE = /Ready on http:\/\/localhost:(\d+)/

  cmd = spawn('vue', ['ui', '--headless'], {
    env: Object.assign({}, process.env, {
      PATH: require('shell-path').sync()
    })
  })
  cmd.stdout.on('data', chunk => {
    const str = chunk.toString()
    if (RE.test(str)) {
      const [, port] = RE.exec(str)
      win.loadURL(`http://localhost:${port}/project/select`)
      win.show()
    }
  })

  win.on('close', e => {
    if (!isQuitting) {
      e.preventDefault()

      if (process.platform === 'darwin') {
github sindresorhus / fix-path / index.js View on Github external
module.exports = () => {
	if (process.platform !== 'darwin') {
		return;
	}

	process.env.PATH = shellPath.sync() || [
		'./node_modules/.bin',
		'/.nodebrew/current/bin',
		'/usr/local/bin',
		process.env.PATH
	].join(':');
};
github 720kb / ndm / lib / js / npm / npm-api.js View on Github external
$rootScope.$on('dom:ready', () => {
    $log.info('DOM is ready for npm');
    //sync shell path or app will not work, yep.
    process.env.PATH = require('shell-path').sync();

    cp.exec('npm root -g', (err, stdout, stderr) => {

      if (err) {

        throw new Error(err);
      }

      if (stderr) {

        $log.warn(stderr);
      }

      let globalFolder = stdout
        , nodeModulesExt = ''; //important

shell-path

Get the $PATH from the shell

MIT
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis

Popular shell-path functions