diff --git a/build/lib/asar.js b/build/lib/asar.js index f836151fd5859..85c63a4073e1b 100644 --- a/build/lib/asar.js +++ b/build/lib/asar.js @@ -64,6 +64,7 @@ function createAsar(folderPath, unpackGlobs, destFilename) { cwd: folderPath, base: folderPath, path: path.join(destFilename + '.unpacked', relative), + stat: file.stat, contents: file.contents })); } @@ -84,11 +85,13 @@ function createAsar(folderPath, unpackGlobs, destFilename) { out.unshift(headerBuf); out.unshift(sizeBuf); } + var contents = Buffer.concat(out); + out.length = 0; _this.queue(new VinylFile({ cwd: folderPath, base: folderPath, path: destFilename, - contents: Buffer.concat(out) + contents: contents })); _this.queue(null); }; diff --git a/build/lib/asar.ts b/build/lib/asar.ts index 2223741906389..e801225503cc0 100644 --- a/build/lib/asar.ts +++ b/build/lib/asar.ts @@ -75,6 +75,7 @@ export function createAsar(folderPath: string, unpackGlobs: string[], destFilena cwd: folderPath, base: folderPath, path: path.join(destFilename + '.unpacked', relative), + stat: file.stat, contents: file.contents })); } else { @@ -97,11 +98,14 @@ export function createAsar(folderPath: string, unpackGlobs: string[], destFilena out.unshift(sizeBuf); } + const contents = Buffer.concat(out); + out.length = 0; + this.queue(new VinylFile({ cwd: folderPath, base: folderPath, path: destFilename, - contents: Buffer.concat(out) + contents: contents })); this.queue(null); }; diff --git a/src/vs/workbench/services/search/node/ripgrepFileSearch.ts b/src/vs/workbench/services/search/node/ripgrepFileSearch.ts index 9b73f7739ecfa..acaccc6693aa1 100644 --- a/src/vs/workbench/services/search/node/ripgrepFileSearch.ts +++ b/src/vs/workbench/services/search/node/ripgrepFileSearch.ts @@ -13,11 +13,14 @@ import { normalizeNFD, startsWith } from 'vs/base/common/strings'; import { IFolderSearch, IRawSearch } from './search'; import { foldersToIncludeGlobs, foldersToRgExcludeGlobs } from './ripgrepTextSearch'; +// If vscode-ripgrep is in an .asar file, then the binary is unpacked. +const rgDiskPath = rgPath.replace(/\bnode_modules\.asar\b/, 'node_modules.asar.unpacked'); + export function spawnRipgrepCmd(config: IRawSearch, folderQuery: IFolderSearch, includePattern: glob.IExpression, excludePattern: glob.IExpression) { const rgArgs = getRgArgs(config, folderQuery, includePattern, excludePattern); const cwd = folderQuery.folder; return { - cmd: cp.spawn(rgPath, rgArgs.args, { cwd }), + cmd: cp.spawn(rgDiskPath, rgArgs.args, { cwd }), siblingClauses: rgArgs.siblingClauses, rgArgs, cwd diff --git a/src/vs/workbench/services/search/node/ripgrepTextSearch.ts b/src/vs/workbench/services/search/node/ripgrepTextSearch.ts index 72ecb4b919d37..cbc4bd814a69b 100644 --- a/src/vs/workbench/services/search/node/ripgrepTextSearch.ts +++ b/src/vs/workbench/services/search/node/ripgrepTextSearch.ts @@ -23,6 +23,9 @@ import { TPromise } from 'vs/base/common/winjs.base'; import { ISerializedFileMatch, ISerializedSearchComplete, IRawSearch, IFolderSearch, LineMatch, FileMatch } from './search'; import { IProgress } from 'vs/platform/search/common/search'; +// If vscode-ripgrep is in an .asar file, then the binary is unpacked. +const rgDiskPath = rgPath.replace(/\bnode_modules\.asar\b/, 'node_modules.asar.unpacked'); + export class RipgrepEngine { private isDone = false; private rgProc: cp.ChildProcess; @@ -72,7 +75,7 @@ export class RipgrepEngine { onMessage({ message: rgCmd }); }); - this.rgProc = cp.spawn(rgPath, rgArgs.args, { cwd }); + this.rgProc = cp.spawn(rgDiskPath, rgArgs.args, { cwd }); process.once('exit', this.killRgProcFn); this.ripgrepParser = new RipgrepParser(this.config.maxResults, cwd, this.config.extraFiles);