Browse Source

Adds stderr to RunError

main
Eric Amodio 3 years ago
parent
commit
97d51efce2
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      src/git/shell.ts

+ 9
- 1
src/git/shell.ts View File

@ -142,10 +142,15 @@ export interface RunOptions {
const bufferExceededRegex = /stdout maxBuffer( length)? exceeded/;
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);
stdout = stdout.trim();
stderr = stderr.trim();
Error.captureStackTrace(this, RunError);
}
@ -187,6 +192,9 @@ export function run(
encoding === 'utf8' || encoding === 'binary' || encoding === 'buffer'
? stdout
: iconv.decode(Buffer.from(stdout, 'binary'), encoding),
encoding === 'utf8' || encoding === 'binary' || encoding === 'buffer'
? stderr
: iconv.decode(Buffer.from(stderr, 'binary'), encoding),
),
);

Loading…
Cancel
Save