fix bug stdin pipe to wrong process

This commit is contained in:
Marc
2022-01-26 14:15:25 +01:00
parent 5e116fb3ac
commit 8c0c34af27
2 changed files with 13 additions and 5 deletions
+8 -2
View File
@@ -1,6 +1,12 @@
//@ts-check
/**
* @param {string} str
* @returns { Promise<string> }
*/
async function getline(str) {
process.stdout.write(str)
process.stdin.resume();
process.stdin.resume()
process.stdin.setEncoding('utf8')
let line = ""
return new Promise((res, rej) => {
@@ -19,7 +25,7 @@ async function getline(str) {
}
function isAlpha(str){
return /^[a-zA-Z]*$/.test(str);
return /^[a-zA-Z]*$/.test(str)
}