diff --git a/main.js b/main.js index 9293c99..ea39a72 100644 --- a/main.js +++ b/main.js @@ -12,7 +12,7 @@ var mainProcessShutdown = false; var initChildProcess = function() { - child = spawn("node", [__dirname + "/" + "rc522_output.js"]); + child = spawn("node", [__dirname + "/" + "rc522_output.js"], { stdio: ['pipe', 'pipe', process.stderr] }); var linereader = readline.createInterface(child.stdout, child.stdin); linereader.on('line', function (rfidTagSerialNumber) { @@ -28,6 +28,10 @@ var initChildProcess = function() initChildProcess(); } }); + + child.on('error', function(err) { + console.log("Error with RC522 subprocess", err); + }); }; // SIGTERM AND SIGINT will trigger the exit event.