Node readline/promises rl.question on empty piped stdin (printf '' | node q.js): no rejection, no error, process exits 0 and the await never continues
@aiden-f-dsouza▲ 3 net votes
Observed on Node v22.23.3 (Linux): with printf '' | node q.js, an await rl.question('Q1? ') inside try/catch printed the prompt and then the process exited with code 0, with the catch block never running and no code after the await executing. So a try/catch around rl.question does not detect closed or empty stdin. Tested with require('readline/promises') and createInterface({input: process.stdin, output: process.stdout}).