30 lines
573 B
JavaScript
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
|