about summary refs log tree commit diff
path: root/editors/code/src
diff options
context:
space:
mode:
authorYaroslav Bolyukin <iam@lach.pw>2021-02-13 23:11:00 +0300
committerYaroslav Bolyukin <iam@lach.pw>2021-02-13 23:11:00 +0300
commit471795b019d800dca65e2a400fbdb166e6f821cd (patch)
tree00f69ad87dfeb290613f138c954fbcae018b121b /editors/code/src
parent3fdc556632e39145678219ace8476e12d7d70d41 (diff)
downloadrust-471795b019d800dca65e2a400fbdb166e6f821cd.tar.gz
rust-471795b019d800dca65e2a400fbdb166e6f821cd.zip
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>
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/main.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index d18d6c8a9f8..620810d7229 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -246,10 +246,10 @@ async function patchelf(dest: PathLike): Promise<void> {
         },
         async (progress, _) => {
             const expression = `
-            {src, pkgs ? import <nixpkgs> {}}:
+            {srcStr, pkgs ? import <nixpkgs> {}}:
                 pkgs.stdenv.mkDerivation {
                     name = "rust-analyzer";
-                    inherit src;
+                    src = /. + srcStr;
                     phases = [ "installPhase" "fixupPhase" ];
                     installPhase = "cp $src $out";
                     fixupPhase = ''
@@ -262,7 +262,7 @@ async function patchelf(dest: PathLike): Promise<void> {
             await fs.rename(dest, origFile);
             progress.report({ message: "Patching executable", increment: 20 });
             await new Promise((resolve, reject) => {
-                const handle = exec(`nix-build -E - --arg src '${origFile}' -o ${dest}`,
+                const handle = exec(`nix-build -E - --argstr srcStr '${origFile}' -o '${dest}'`,
                     (err, stdout, stderr) => {
                         if (err != null) {
                             reject(Error(stderr));