提交 b0c544de 编写于 作者: R Rob Lourens

Fix EventEmitter warning for search with more than 11 workspace folders

上级 b59fd519
......@@ -45,6 +45,11 @@ interface IDirectoryTree {
pathToEntries: { [relativePath: string]: IDirectoryEntry[] };
}
const killCmds = new Set<() => void>();
process.on('exit', () => {
killCmds.forEach(cmd => cmd());
});
export class FileWalker {
private config: IRawSearch;
private useRipgrep: boolean;
......@@ -191,9 +196,10 @@ export class FileWalker {
const isMac = platform.isMacintosh;
let cmd: childProcess.ChildProcess;
const killCmd = () => cmd && cmd.kill();
killCmds.add(killCmd);
let done = (err?: Error) => {
process.removeListener('exit', killCmd);
killCmds.delete(killCmd);
done = () => { };
cb(err);
};
......@@ -221,7 +227,6 @@ export class FileWalker {
cmd = this.spawnFindCmd(folderQuery);
}
process.on('exit', killCmd);
this.cmdResultCount = 0;
this.collectStdout(cmd, 'utf8', useRipgrep, onMessage, (err: Error, stdout?: string, last?: boolean) => {
if (err) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册