Added stderr output to the test command & updated console output

This commit is contained in:
Ian Wijma 2023-11-19 13:36:20 +11:00
parent afccf3a5c5
commit 77e1f29417
2 changed files with 12 additions and 4 deletions

View File

@ -9,4 +9,10 @@ sleep $SLEEP;
echo "Waking up!"; echo "Waking up!";
if [ $EXIT > 0 ]; then
>&2 echo "Exiting with error code $EXIT";
else
echo "Exiting with error code $EXIT";
fi
exit $EXIT; exit $EXIT;

View File

@ -87,8 +87,10 @@ const runCommand = () => {
}; };
const handleExit = (exitCode) => { const handleExit = (exitCode) => {
if (exitCode === 0) {
console.log(`Exit code: ${exitCode}`);
} else{
console.log(`[CRASH] exit code: ${exitCode}`) console.log(`[CRASH] exit code: ${exitCode}`)
if (exitCode !== 0) {
pushHistory(getLogs()); pushHistory(getLogs());
clearLogs(); clearLogs();
updateHistory(); updateHistory();
@ -107,8 +109,8 @@ const runCommand = () => {
runner.on('close', (exitCode) => handleExit(exitCode)) runner.on('close', (exitCode) => handleExit(exitCode))
runner.stdout.on('data', (data) => console.log(data.toString().trim())) runner.stdout.on('data', (data) => console.log(data.toString().trim()))
runner.stdout.on('data', (data) => handleOut('stdout', data.toString().trim())) runner.stdout.on('data', (data) => handleOut('LOG', data.toString().trim()))
runner.stderr.on('data', (data) => handleOut('stderr', data.toString().trim())) runner.stderr.on('data', (data) => handleOut('ERR', data.toString().trim()))
} }
// Command goes BRRRR // Command goes BRRRR