don't decode stderr

This commit is contained in:
Joao Moreno
2017-04-24 10:37:15 +02:00
parent 7cf0ad0440
commit 3598679114

View File

@@ -179,12 +179,12 @@ export async function exec(child: cp.ChildProcess, encoding: string = 'utf8'): P
new Promise<string>(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<string>(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;