function spawnDetached( cwd, command, args, output, env ) { const stdio = output ? [ 'ignore', output, output ] : null; const app = spawn( command, args, { stdio, detached: true, env, cwd } ); app.on( 'error', ( err ) => { throw `failed to initialize command "${ command }": "${ err }"`; } ); return app; }
schnackEvents.on('new-comment', event => { const body = createEmailBody(config, event); try { const sendmail = spawn('sendmail', [notify.sendmail.to]); sendmail.stdin.write(body); sendmail.stdin.end(); } catch (error) { console.error('Error sending sendmail notification:', error); } });
test.cb('remove temporary files on cancel', t => { t.plan(1); const cp = spawn('../cli.js', ['https://sindresorhus.com', '320x240']); cp.on('exit', () => { t.false(fs.existsSync('sindresorhus.com-320x240.png')); t.end(); }); setTimeout(() => { cp.kill('SIGINT'); }, 500); });
function getPipExe() { const pip = which.sync("pip3", { nothrow: true }) || which.sync("pip", { nothrow: true }); if (pip) { return pip; } // try python -m pip const pythonExe = getPythonExe(); return new Promise((resolve, reject) => { var child = spawn(pythonExe, ["-m", "pip"]); child.on("close", code => { if (code === 0) resolve([pythonExe, "-m", "pip"]); else resolve(); }); }); }
const windowSimulator = () => { const projInfo = JSON.parse(fs.readFileSync(path.join(__dirname, '../lib/projInfo.js'))); //Simulation for CRA if (projInfo.devServerScript === 'start') { const child = spawn('npm', ['start'], {cwd: projInfo.rootPath}); child.stdout.on('data', (data) => { global.mainWindow.webContents.send('start simulator',['http://localhost:3000',child.pid]); }); //Simulation for react-dev-server } else if (projInfo.devServerScript === 'run dev-server') { let child = spawn('npm', ['run', 'reactide-server'], {cwd: projInfo.rootPath}); child.stdout.on('data', (data) => { global.mainWindow.webContents.send('start simulator',['http://localhost:8085', child.pid]); }) } else if (projInfo.htmlPath) { global.mainWindow.webContents.send('file://' + projInfo.htmlPath); } else { console.log('No Index.html found'); } }
const benchmark = spawn( process.argv[0], [join(benchmarkDir, benchmarks[name])]
childProcess.spawn.apply(null, options.postPushCommand)
if (options.data) env.NDD_DATA = options.data; const p = spawn(execPath, args, { cwd: options.cwd ? fileURLToPath(options.cwd) : undefined, env: { ...process.env, ...env },
const proc = spawn(editor, args, { stdio: 'inherit' }) const startTime = Date.now() await new Promise((resolve, reject) => {
return childProcess.spawn('java', args, { shell: true, stdio: 'inherit'
let child = spawn(command.split(' ')[0], command.split(' ').slice(1), {cwd: cwd, shell: true});
if (err) return callback(err) const program = spawn(process.execPath, [BIN_PATH, ...args.slice(1)], { cwd: tempdir, env: Object.assign(
spawned = childProcess.spawn(parsed.file, parsed.args, parsed.options); } catch (error) {
function getPipExe() { const pip = which.sync("pip3", { nothrow: true }) || which.sync("pip", { nothrow: true }); if (pip) { return pip; } // try python -m pip const pythonExe = getPythonExe(); return new Promise((resolve, reject) => { var child = spawn(pythonExe, ["-m", "pip"]); child.on("close", code => { if (code === 0) resolve([pythonExe, "-m", "pip"]); else resolve(); }); }); }