|
|
@@ -76,13 +76,19 @@ const readline = require("readline"); |
|
|
|
var cli = { |
|
|
|
nodeShellExec |
|
|
|
, get prompter() { |
|
|
|
const clii = readline.createInterface({ input: process.stdin, output: process.stdout }); |
|
|
|
clii.ask = function(q){ |
|
|
|
return new Promise((resolve, reject)=>{ |
|
|
|
clii.question(q, (answer)=>{ resolve(answer) }) |
|
|
|
}) |
|
|
|
var prompt_interface = { |
|
|
|
ask : function(q){ |
|
|
|
// Needs to be serialized. Parallel asks are not possible. |
|
|
|
const clii = readline.createInterface({ input: process.stdin, output: process.stdout }); |
|
|
|
return new Promise((resolve, reject)=>{ |
|
|
|
clii.question(q, (answer)=>{ |
|
|
|
clii.close(); |
|
|
|
resolve(answer) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
return clii |
|
|
|
return prompt_interface |
|
|
|
} |
|
|
|
, prompt |
|
|
|
} |