Fix #53838 - workaround strange error from telemetry

This commit is contained in:
Rob Lourens 2018-07-09 09:21:05 -07:00
parent 8422fccff1
commit b6902fd662
2 changed files with 19 additions and 8 deletions

View file

@ -114,16 +114,22 @@ export class RipgrepFileSearchEngine implements IInternalFileSearchProvider {
cb(err, stdout, last);
};
let gotData = false;
if (cmd.stdout) {
// Should be non-null, but #38195
this.forwardData(cmd.stdout, onData);
cmd.stdout.once('data', () => gotData = true);
} else {
this.outputChannel.appendLine('stdout is null');
}
const stderr = this.collectData(cmd.stderr);
let gotData = false;
cmd.stdout.once('data', () => gotData = true);
let stderr: Buffer[];
if (cmd.stderr) {
// Should be non-null, but #38195
stderr = this.collectData(cmd.stderr);
} else {
this.outputChannel.appendLine('stderr is null');
}
cmd.on('error', (err: Error) => {
onData(err);

View file

@ -384,17 +384,22 @@ export class FileWalker {
cb(err, stdout, last);
};
let gotData = false;
if (cmd.stdout) {
// Should be non-null, but #38195
this.forwardData(cmd.stdout, encoding, onData);
cmd.stdout.once('data', () => gotData = true);
} else {
onMessage({ message: 'stdout is null' });
}
const stderr = this.collectData(cmd.stderr);
let gotData = false;
cmd.stdout.once('data', () => gotData = true);
let stderr: Buffer[];
if (cmd.stderr) {
// Should be non-null, but #38195
stderr = this.collectData(cmd.stderr);
} else {
onMessage({ message: 'stderr is null' });
}
cmd.on('error', (err: Error) => {
onData(err);