child.stdout.on("data", msg => { msg = msg .toString() .split("\n") .filter(m => { return m.indexOf("already satisfied") === -1; }) .join("\n"); process.stdout.write(msg); });
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; }
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 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.stderr.on("data", data => { console.error(`get-pip.py: ${data}`); });
child.on("close", () => { // console.log("Requirements install completed.") resolve(); });
child.stderr.on("data", m => process.stderr.write(m));
child.stdout.on("data", msg => { msg = msg .toString() .split("\n") .filter(m => { return m.indexOf("already satisfied") === -1; }) .join("\n"); process.stdout.write(msg); });
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(); });
child.stderr.on("data", data => { console.error(`get-pip.py: ${data}`); });
child.stderr.on("data", m => process.stderr.write(m));
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(); }); }); }