mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-22 17:48:56 +01:00
@@ -171,6 +171,9 @@ async function exec(child: cp.ChildProcess, options: any = {}): Promise<IExecuti
|
||||
disposables.push(toDisposable(() => ee.removeListener(name, fn)));
|
||||
};
|
||||
|
||||
let encoding = options.encoding || 'utf8';
|
||||
encoding = iconv.encodingExists(encoding) ? encoding : 'utf8';
|
||||
|
||||
const [exitCode, stdout, stderr] = await Promise.all<any>([
|
||||
new Promise<number>((c, e) => {
|
||||
once(child, 'error', e);
|
||||
@@ -179,7 +182,7 @@ async function exec(child: cp.ChildProcess, options: any = {}): Promise<IExecuti
|
||||
new Promise<string>(c => {
|
||||
const buffers: Buffer[] = [];
|
||||
on(child.stdout, 'data', b => buffers.push(b));
|
||||
once(child.stdout, 'close', () => c(iconv.decode(Buffer.concat(buffers), options.encoding || 'utf8')));
|
||||
once(child.stdout, 'close', () => c(iconv.decode(Buffer.concat(buffers), encoding)));
|
||||
}),
|
||||
new Promise<string>(c => {
|
||||
const buffers: Buffer[] = [];
|
||||
|
||||
Reference in New Issue
Block a user