(output)
| 154 | let waitAnswer = true; |
| 155 | |
| 156 | const writeAnswer = (output) => { |
| 157 | if (answers.length === 0) { |
| 158 | proc.stdin.write(output); |
| 159 | processKill(proc); |
| 160 | |
| 161 | return; |
| 162 | } |
| 163 | |
| 164 | if (currentAnswer < answers.length) { |
| 165 | const answer = answers[currentAnswer]; |
| 166 | |
| 167 | proc.stdin.write(answer); |
| 168 | waitAnswer = true; |
| 169 | currentAnswer++; |
| 170 | } |
| 171 | }; |
| 172 | |
| 173 | // Uncomment for debugging |
| 174 | // proc.stderr.pipe(process.stdout); |