maestro/app/classes/logical/ExecutionResult.js
2020-02-21 00:36:55 -06:00

30 lines
573 B
JavaScript

const { Injectable } = require('flitter-di')
class ExecutionResult extends Injectable {
stdout = []
stderr = []
exit_code = 0
out(data) {
this.stdout = this.stdout.concat(String(data).split('\n'))
}
error(data) {
this.stderr = this.stderr.concat(String(data).split('\n'))
}
exit(code) {
this.exit_code = Number(code)
}
get clean_out() {
return this.stdout.filter(Boolean)
}
get clean_err() {
return this.stdout.filter(Boolean)
}
}
module.exports = exports = ExecutionResult