eclipse-theia/theia

[search-in-workspace] Workspace search does not work in Electron with asar packaging

Open

#7528 opened on Apr 8, 2020

View on GitHub
 (4 comments) (2 reactions) (0 assignees)TypeScript (18,676 stars) (2,478 forks)batch import
electronelectron-buildhelp wantedsearch in workspace

Description

Description

Workspace search does not work in Electron with asar packaging enabled because rg cannot be spawned. The following message is shown when launching the Electron executable via a console:

process ERROR Error: spawn C:\path\to\application\resources\app.asar\node_modules\vscode-ripgrep\bin\rg.exe ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)

In the above path, app.asar should be replaced with app.asar.unpacked, as binaries cannot be in the asar file and have to be unpacked instead in order to be executable. However, the rg path (created here and used here) does not take this into account.

See also https://github.com/electron/electron/issues/6262 for a general discussion about this issue.

Reproduction Steps

  1. Enter anything in the workspace search box. No search results are shown.

OS and Theia version: Windows 10 1803, Theia 0.16.1.

Diagnostics: See above.

Contributor guide