dthree / vorpal

Node's framework for interactive CLIs
http://vorpal.js.org
MIT License
5.64k stars 280 forks source link

Process keystrokes while command is running #209

Open sidorenkobw opened 7 years ago

sidorenkobw commented 7 years ago

Hi guys,

How can I process keyboard events while my command is running (promise is returned). vorpal.on("keypress"...) works only when prompt is available.

Thank you

sidorenkobw commented 7 years ago

A small note. In my command I spawn a child process which works in a background. I tried different stdio options, like: omitting, ["ignore", "pipe", "pipe"], ["ignore", "ignore", "pipe"], ... In each case my keypress handler is called after command is finished.

sidorenkobw commented 7 years ago

I found a work around for this by calling: stdin.setRawMode(true); stdin.resume(); But after this ctrl+c is not working anymore How can make it work back again?