I've seen this question asked of other platform/languages - any ideas? I'd like to do something like:
if (detectDebug())
{
require('tty').setRawMode(true);
var stdin = process.openStdin();
stdin.on('keypress', function (chunk, key) {
DoWork();
}
}
else
{
DoWork();
}
I'd like to be able to toggle keyboard input as a start for the script when debugging so that I can have a moment to fire up chrome to listen to my node-inspector port.
***Quick update - I'm guessing I can actually use "process.argv" to detect if --debug was passed in. Is this the best/right way?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…