|
@ -142,10 +142,15 @@ export interface RunOptions { |
|
|
const bufferExceededRegex = /stdout maxBuffer( length)? exceeded/; |
|
|
const bufferExceededRegex = /stdout maxBuffer( length)? exceeded/; |
|
|
|
|
|
|
|
|
export class RunError extends Error { |
|
|
export class RunError extends Error { |
|
|
constructor(private readonly original: ExecException, public readonly stdout: string) { |
|
|
|
|
|
|
|
|
constructor( |
|
|
|
|
|
private readonly original: ExecException, |
|
|
|
|
|
public readonly stdout: string, |
|
|
|
|
|
public readonly stderr: string, |
|
|
|
|
|
) { |
|
|
super(original.message); |
|
|
super(original.message); |
|
|
|
|
|
|
|
|
stdout = stdout.trim(); |
|
|
stdout = stdout.trim(); |
|
|
|
|
|
stderr = stderr.trim(); |
|
|
Error.captureStackTrace(this, RunError); |
|
|
Error.captureStackTrace(this, RunError); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -187,6 +192,9 @@ export function run( |
|
|
encoding === 'utf8' || encoding === 'binary' || encoding === 'buffer' |
|
|
encoding === 'utf8' || encoding === 'binary' || encoding === 'buffer' |
|
|
? stdout |
|
|
? stdout |
|
|
: iconv.decode(Buffer.from(stdout, 'binary'), encoding), |
|
|
: iconv.decode(Buffer.from(stdout, 'binary'), encoding), |
|
|
|
|
|
encoding === 'utf8' || encoding === 'binary' || encoding === 'buffer' |
|
|
|
|
|
? stderr |
|
|
|
|
|
: iconv.decode(Buffer.from(stderr, 'binary'), encoding), |
|
|
), |
|
|
), |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|