function executeCommand(command, args, options = {}) { const child = spawn(command, args, { stdio: 'inherit', ...options }); return new Promise((resolve, reject) => { child.on('close', (code) => { if (code !== 0) { reject(new Error(`${command} ${args.join(' ')} failed with exit code ${code}. Please check your console.`)); return; } resolve(); }); }); }
const handleArguments = (file, args, options = {}) => { const parsed = crossSpawn._parse(file, args, options); file = parsed.command; args = parsed.args;
app.get('/playground/start-dashboard-app', catchErrors(async (req, res) => { this.cubejsServer.event('Dev Server Start Dashboard App'); if (!this.dashboardAppProcess) { this.dashboardAppProcess = spawn('npm', ['run', 'start'], { cwd: dashboardAppPath, env: {
crossSpawn._enoent.hookChildProcess(spawned, parsed.parsed);
// Git clone helper const tryGitClone = (url, projectName) => { const clone = spawn.sync('git', ['clone', url, projectName], { stdio: 'inherit', }); return clone; }
function run({ alias, cwd, env } = {}, args = []) { const cmd = path.join(path.resolve(__dirname, "../.."), alias || "cli.js"); const cp = spawn(cmd, args, { cwd, env: Object.assign({}, process.env, env)
spawn.sync('npm', ['install'], { cwd: `${projectName}`, stdio: 'inherit' }); spawn.sync('npm', ['install'], { cwd: `${projectName}/api`, stdio: 'inherit', }); spawn.sync('npm', ['install'], { cwd: `${projectName}/frontend`, stdio: 'inherit', }); } else { spawn.sync('yarn', { cwd: `${projectName}`, stdio: 'inherit' });
function spawnIfNodeVersionSatisfies( versionRange, command, args, options ) { if (isNodeVersionSatisfies(versionRange)) { return spawn(command, args, options) } return null }
// sync function installDep () { Object.entries(config.wskManifestActions).forEach(([name, action]) => { const actionPath = path.join(config.rootDir, action.function) if (fs.statSync(actionPath).isDirectory() && fs.readdirSync(actionPath).includes('package.json')) { // npm install const install = spawn.sync(`npm`, ['install', '--no-package-lock'], { cwd: actionPath }) if (install.error) throw install.error if (install.status !== 0) throw new Error(install.stderr.toString()) } }) }
function spawn (command, args, opts, cb) { opts.stdio = debug.enabled ? 'inherit' : 'ignore' const child = crossSpawn(command, args, opts) child.on('error', cb) child.on('close', function (code) { if (code !== 0) return cb(new Error('Non-zero exit code: ' + code)) cb(null) }) return child }
function spawnIfNodeVersionSatisfiesSync( versionRange, command, args, options ) { if (isNodeVersionSatisfies(versionRange)) { return spawn.sync(command, args, options) } return null }
function spawn (command, args, opts, cb) { if (!opts.stdio) opts.stdio = 'inherit' var child = crossSpawn(command, args, opts) child.on('error', cb) child.on('close', function (code) { if (code !== 0) return cb(new Error('non-zero exit code: ' + code)) cb(null) }) return child }
const executeCommand = (command, args) => { const child = spawn(command, args, { stdio: 'inherit' }); return new Promise((resolve, reject) => { child.on('close', code => { if (code !== 0) { reject(new Error(`${command} ${args.join(' ')} failed with exit code ${code}`)); return; } resolve(); }); }); }
// Git clone helper const tryGitClone = (url, projectName) => { const clone = spawn.sync('git', ['clone', url, projectName], { stdio: 'inherit', }); return clone; }
spawn.sync('npm', ['install'], { cwd: `${projectName}`, stdio: 'inherit' }); spawn.sync('npm', ['install'], { cwd: `${projectName}/api`, stdio: 'inherit', }); spawn.sync('npm', ['install'], { cwd: `${projectName}/frontend`, stdio: 'inherit', }); } else { spawn.sync('yarn', { cwd: `${projectName}`, stdio: 'inherit' });