diff --git a/bin/run.sh b/bin/run.sh index 3e94dc3..bde7751 100755 --- a/bin/run.sh +++ b/bin/run.sh @@ -9,4 +9,10 @@ sleep $SLEEP; echo "Waking up!"; +if [ $EXIT > 0 ]; then + >&2 echo "Exiting with error code $EXIT"; +else + echo "Exiting with error code $EXIT"; +fi + exit $EXIT; \ No newline at end of file diff --git a/src/index.js b/src/index.js index ef45515..a646fc3 100644 --- a/src/index.js +++ b/src/index.js @@ -87,8 +87,10 @@ const runCommand = () => { }; const handleExit = (exitCode) => { - console.log(`[CRASH] exit code: ${exitCode}`) - if (exitCode !== 0) { + if (exitCode === 0) { + console.log(`Exit code: ${exitCode}`); + } else{ + console.log(`[CRASH] exit code: ${exitCode}`) pushHistory(getLogs()); clearLogs(); updateHistory(); @@ -107,8 +109,8 @@ const runCommand = () => { runner.on('close', (exitCode) => handleExit(exitCode)) runner.stdout.on('data', (data) => console.log(data.toString().trim())) - runner.stdout.on('data', (data) => handleOut('stdout', data.toString().trim())) - runner.stderr.on('data', (data) => handleOut('stderr', data.toString().trim())) + runner.stdout.on('data', (data) => handleOut('LOG', data.toString().trim())) + runner.stderr.on('data', (data) => handleOut('ERR', data.toString().trim())) } // Command goes BRRRR