I like to check if there is any data in stdin and if there isn't to move on. When I write this code
process.stdin.on 'data', (d) ->
console.log 'data ' + d.length + " " + d
process.stdin.on 'end', () ->
console.log 'end'
It blocks and allows me to type into my console. I don't want that. I really only want to know if data was piped in (such as echo 'data' |
) and if not ignore stdin. How do I check if there is data in stdin without blocking?