child.on("close", async () => { var pip = await getPipExe(); if (pip) { console.log("Pip installation completed."); resolve(pip); } else { console.log("Pip installation failed. Please install manually."); } });
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; }
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(); }); }); }
child.on("close", () => { // console.log("Requirements install completed.") resolve(); });
benchmark.on('exit', () => { console.log() if (done && typeof done === 'function') done(null, benchmarkResults)
}); child.stdout.on('data', (data) => { terminal.write('\r\n' + data.toString().replace(/(\r\n|\n|\r)/gm," ") + ' \r\n'); }); child.on('close', (code) => { terminal.write('\r\n' + cwd + '\r\n'); terminal.write('$'); }); child.stderr.on('data', (data) => { terminal.write(data.toString() + '\r\n'); reject(); child.stdout.on('data', (data) => { let output = data.toString().replace(/(\r\n|\n|\r)/gm,""); terminal.write(output + '\r\n'); }); child.on('close', () => { terminal.write(cwd + '\r\n'); terminal.write('$');
// support callback child.on('close', function(code) { if (callback) { callback(code, stdout, stderr, pathsToCss, opts); } });
child.on("close", async () => { var pip = await getPipExe(); if (pip) { console.log("Pip installation completed."); resolve(pip); } else { console.log("Pip installation failed. Please install manually."); } });
child.on("close", () => { // console.log("Requirements install completed.") resolve(); });
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(); }); }); }