fix bug stdin pipe to wrong process
This commit is contained in:
@@ -6,11 +6,12 @@ let environment = require('../lib/sheebr/environment')
|
||||
let aliases = require("../lib/sheebr/aliases")
|
||||
let { spawn } = require('child_process')
|
||||
|
||||
//utiliser ce code au lieuxc de execSync permet d'afficher le stdout au fur et a mesure ce qui fait qu'on a les logs quand une application throw une erreur
|
||||
//utiliser ce code au lieux de execSync permet d'afficher le stdout au fur et a mesure ce qui fait qu'on a les logs quand une application throw une erreur
|
||||
async function spawnAndWait(cmd, option) {
|
||||
const child = spawn(cmd, option)
|
||||
|
||||
child.stdout.pipe(process.stdout)
|
||||
child.stderr.pipe(process.stderr)
|
||||
process.stdin.pipe(child.stdin)
|
||||
|
||||
await new Promise((res, rej) => {
|
||||
@@ -18,6 +19,7 @@ async function spawnAndWait(cmd, option) {
|
||||
res()
|
||||
})
|
||||
})
|
||||
process.stdin.unpipe(child.stdin)
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +30,8 @@ start()
|
||||
async function start(){
|
||||
while(true){
|
||||
const input = await getline("sheebr> ");
|
||||
if(input == "exit") break;
|
||||
if(input == "") continue;
|
||||
if(input === "exit") break;
|
||||
if(!input) continue;
|
||||
else await evaluate(input);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user