handle failed commands, return actual exit code. fixes #4

This won't ever actually execute because JavaScript is single threaded/event driven.  The event cannot fire until the stack is cleared, which never happens because we are waiting in a while loop for this file to be created.