Add extra rg logging for #100373

This commit is contained in:
Rob Lourens
2020-07-20 21:24:53 -07:00
parent ca7f73b70c
commit 8dff81ed55
3 changed files with 13 additions and 2 deletions

View File

@@ -205,7 +205,7 @@ export class FileWalker {
.map(arg => arg.match(/^-/) ? arg : `'${arg}'`)
.join(' ');
let rgCmd = `rg ${escapedArgs}\n - cwd: ${ripgrep.cwd}`;
let rgCmd = `${ripgrep.rgDiskPath} ${escapedArgs}\n - cwd: ${ripgrep.cwd}`;
if (ripgrep.rgArgs.siblingClauses) {
rgCmd += `\n - Sibling clauses: ${JSON.stringify(ripgrep.rgArgs.siblingClauses)}`;
}

View File

@@ -23,6 +23,7 @@ export function spawnRipgrepCmd(config: IFileQuery, folderQuery: IFolderQuery, i
const cwd = folderQuery.folder.fsPath;
return {
cmd: cp.spawn(rgDiskPath, rgArgs.args, { cwd }),
rgDiskPath,
siblingClauses: rgArgs.siblingClauses,
rgArgs,
cwd

View File

@@ -44,7 +44,7 @@ export class RipgrepTextSearchEngine {
const escapedArgs = rgArgs
.map(arg => arg.match(/^-/) ? arg : `'${arg}'`)
.join(' ');
this.outputChannel.appendLine(`rg ${escapedArgs}\n - cwd: ${cwd}`);
this.outputChannel.appendLine(`${rgDiskPath} ${escapedArgs}\n - cwd: ${cwd}`);
let rgProc: Maybe<cp.ChildProcess> = cp.spawn(rgDiskPath, rgArgs, { cwd });
rgProc.on('error', e => {
@@ -57,6 +57,7 @@ export class RipgrepTextSearchEngine {
const ripgrepParser = new RipgrepParser(options.maxResults, cwd, options.previewOptions);
ripgrepParser.on('result', (match: TextSearchResult) => {
gotResult = true;
dataWithoutResult = '';
progress.report(match);
});
@@ -79,8 +80,12 @@ export class RipgrepTextSearchEngine {
cancel();
});
let dataWithoutResult = '';
rgProc.stdout!.on('data', data => {
ripgrepParser.handleData(data);
if (!gotResult) {
dataWithoutResult += data;
}
});
let gotData = false;
@@ -96,7 +101,12 @@ export class RipgrepTextSearchEngine {
rgProc.on('close', () => {
this.outputChannel.appendLine(gotData ? 'Got data from stdout' : 'No data from stdout');
this.outputChannel.appendLine(gotResult ? 'Got result from parser' : 'No result from parser');
if (dataWithoutResult) {
this.outputChannel.appendLine(`Got data without result: ${dataWithoutResult}`);
}
this.outputChannel.appendLine('');
if (isDone) {
resolve({ limitHit });
} else {