瀏覽代碼

Adds stderr to RunError

main
Eric Amodio 3 年之前
父節點
當前提交
97d51efce2
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. +9
    -1
      src/git/shell.ts

+ 9
- 1
src/git/shell.ts 查看文件

@ -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…
取消
儲存