diff --git a/bin/workflow.js b/bin/workflow.js
index 9d5974f..3fcefd8 100644
--- a/bin/workflow.js
+++ b/bin/workflow.js
@@ -6,6 +6,7 @@ const request = new PixlRequest();
const he = require('he');
const {EOL} = require('os')
const JSONStream = require('pixl-json-stream');
+const { profileEnd } = require('console');
let bullet = '>' // '⬤'
@@ -381,6 +382,7 @@ stream.on('json', function (job) {
})
function getNiceTitle(job, id) {
+ if(!job) return ''
let title = ' ' + job.seq + ' :: ' + (job.title || 'Unknown') + ''
// if(id) title = `${id} :: ${title} `
// if(job.arg) title = title + ' :: ' + job.arg
@@ -406,7 +408,7 @@ stream.on('json', function (job) {
jobStatus[key].start,
niceInterval(jobStatus[key].elapsed),
getNiceStatus(jobStatus[key]), // status
- key === jobStatus[key].event ? '' : ``,
+ key === jobStatus[key].event ? '' : ``,
//jobStatus[key].code ? `${he.encode(jobStatus[key].description)}`.substring(0,120) : ''
`${he.encode(jobStatus[key].description)}`.substring(0, 120)
@@ -428,6 +430,10 @@ stream.on('json', function (job) {
};
- poll().catch(e => stream.write({ complete: 1, code: 1, description: e.message }));
+ poll().catch(e => {
+ stream.write({ complete: 1, code: 1, description: 'Plugin crashed: ' + e.message })
+ //if(process.connected) process.disconnect()
+ process.exit(1)
+ });
});
\ No newline at end of file