How to use the safeps.spawn function in safeps

To help you get started, we’ve selected a few safeps 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 bevry / lazy-require / source / index.js View on Github external
error = new Error(
			'lazy-require: cannot save the module as `opts.cwd` did not contain a `package.json` file'
		)
	}

	// Install
	else {
		// Arguments
		const args = ['npm', 'install', name]
		if (opts.save === true) {
			args.push('--save')
			opts.save = null // {delete opts.save} is very slow
		}

		// Install
		safeps.spawn(args, opts, function(err) {
			// Check
			if (err) return next(err)

			// Try to load the module
			lazyRequire.require(name, opts, next)
		})

		// Exit
		return null
	}

	// Complete
	return complete(error, null, next)
}
github bevry / boundation / source / fs.js View on Github external
return new Promise(function(resolve, reject) {
		safeps.spawn(command, opts, function(err, stdout) {
			if (err)
				return reject(new Errlop(`spawn failed: ${command.join(' ')}`, err))
			return resolve(stdout)
		})
	})
}
github nfriedly / nfriedly.com / node_modules / docpad / out / lib / util.js View on Github external
startLocalDocPadExecutable: function(next) {
      var args, command;
      args = process.argv.slice(2);
      command = ['node', docpadUtil.getLocalDocPadExecutable()].concat(args);
      return require('safeps').spawn(command, {
        stdio: 'inherit'
      }, function(err) {
        var message;
        if (err) {
          if (next) {
            return next(err);
          } else {
            message = 'An error occured within the child DocPad instance: ' + err.message + '\n';
            return process.stderr.write(message);
          }
        } else {
          return typeof next === "function" ? next() : void 0;
        }
      });
    },
    getBasename: function(filename) {

safeps

Work with processes safely and easily with Node.js

Artistic-2.0
Latest version published 10 months ago

Package Health Score

61 / 100
Full package analysis