Skip to content

Commit 471795b

Browse files
committed
fix: tolerate spaces in nix binary patching
If path to original file contains space (I.e on code insiders, where default data directory is ~/Code - Insiders/), then there is syntax error evaluating src arg. Instead pass path as str, and coerce to path back in nix expression Signed-off-by: Yaroslav Bolyukin <iam@lach.pw>
1 parent 3fdc556 commit 471795b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

editors/code/src/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,10 @@ async function patchelf(dest: PathLike): Promise<void> {
246246
},
247247
async (progress, _) => {
248248
const expression = `
249-
{src, pkgs ? import <nixpkgs> {}}:
249+
{srcStr, pkgs ? import <nixpkgs> {}}:
250250
pkgs.stdenv.mkDerivation {
251251
name = "rust-analyzer";
252-
inherit src;
252+
src = /. + srcStr;
253253
phases = [ "installPhase" "fixupPhase" ];
254254
installPhase = "cp $src $out";
255255
fixupPhase = ''
@@ -262,7 +262,7 @@ async function patchelf(dest: PathLike): Promise<void> {
262262
await fs.rename(dest, origFile);
263263
progress.report({ message: "Patching executable", increment: 20 });
264264
await new Promise((resolve, reject) => {
265-
const handle = exec(`nix-build -E - --arg src '${origFile}' -o ${dest}`,
265+
const handle = exec(`nix-build -E - --argstr srcStr '${origFile}' -o '${dest}'`,
266266
(err, stdout, stderr) => {
267267
if (err != null) {
268268
reject(Error(stderr));

0 commit comments

Comments
 (0)