You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
898 B

export class ExecutionResult {
protected stdout: string[] = []
protected stderr: string[] = []
protected mixed: string[] = []
public exitCode?: number
out(data: any) {
this.stdout = this.stdout.concat(`${data}`.split('\n'))
this.mixed = this.mixed.concat(`${data}`.split('\n'))
}
error(data: any) {
this.stderr = this.stderr.concat(`${data}`.split('\n'))
this.mixed = this.mixed.concat(`${data}`.split('\n'))
}
exit(code: number) {
this.exitCode = code
}
public wasSuccessful(): boolean {
return this.exitCode === 0
}
public get combinedOutput(): string[] {
return this.mixed.filter(Boolean)
}
public get standardOutput(): string[] {
return this.stdout.filter(Boolean)
}
public get errorOutput(): string[] {
return this.stderr.filter(Boolean)
}
}