diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index 3f9ee19ccda..dc6be088a48 100644 --- a/extensions/git/src/git.ts +++ b/extensions/git/src/git.ts @@ -179,12 +179,12 @@ export async function exec(child: cp.ChildProcess, encoding: string = 'utf8'): P new Promise(c => { const buffers: Buffer[] = []; on(child.stdout, 'data', b => buffers.push(b)); - once(child.stdout, 'close', () => c(decode(Buffer.concat(buffers), encoding))); + once(child.stdout, 'close', () => c(iconv.decode(Buffer.concat(buffers), encoding))); }), new Promise(c => { const buffers: Buffer[] = []; on(child.stderr, 'data', b => buffers.push(b)); - once(child.stderr, 'close', () => c(decode(Buffer.concat(buffers), encoding))); + once(child.stderr, 'close', () => c(Buffer.concat(buffers).toString('utf8'))); }) ]); @@ -193,10 +193,6 @@ export async function exec(child: cp.ChildProcess, encoding: string = 'utf8'): P return { exitCode, stdout, stderr }; } -function decode(buffer: NodeBuffer, encoding: string): string { - return iconv.decode(buffer, encoding); -} - export interface IGitErrorData { error?: Error; message?: string;