diff options
author | 06kellyjac <dev@j-k.io> | 2020-08-21 23:08:15 +0100 |
---|---|---|
committer | 06kellyjac <dev@j-k.io> | 2020-08-21 23:08:15 +0100 |
commit | 01c32e49a94db858d3c4bc0b23d311df202fb329 (patch) | |
tree | b1517c75ed1ff658c69c56dc70a648a78d9ceaee /pkgs/development/web | |
parent | 3fbad3ec7a0c5c18cb188ee7c104ffa89031b240 (diff) | |
download | nixpkgs-01c32e49a94db858d3c4bc0b23d311df202fb329.tar nixpkgs-01c32e49a94db858d3c4bc0b23d311df202fb329.tar.gz nixpkgs-01c32e49a94db858d3c4bc0b23d311df202fb329.tar.bz2 nixpkgs-01c32e49a94db858d3c4bc0b23d311df202fb329.tar.lz nixpkgs-01c32e49a94db858d3c4bc0b23d311df202fb329.tar.xz nixpkgs-01c32e49a94db858d3c4bc0b23d311df202fb329.tar.zst nixpkgs-01c32e49a94db858d3c4bc0b23d311df202fb329.zip |
deno: avoid nix-prefetch error
nix-prefetch is failing with an error containing 'allow-unsafe-native-code-during-evaluation'. This change avoids and handles this error so the update still used. This isn't intended as a permanent fix but it works for now.
Diffstat (limited to 'pkgs/development/web')
-rw-r--r-- | pkgs/development/web/deno/update/common.ts | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/pkgs/development/web/deno/update/common.ts b/pkgs/development/web/deno/update/common.ts index 71e4d638f8d..d8956b21d16 100644 --- a/pkgs/development/web/deno/update/common.ts +++ b/pkgs/development/web/deno/update/common.ts @@ -8,7 +8,20 @@ const run = async (command: string, args: string[]) => { { cmd: [command, ...args], stdout: "piped", stderr: "piped" }, ); if (!(await cmd.status()).success) { - throw await cmd.stderrOutput().then((b) => decode(b)); + const error = await cmd.stderrOutput().then((b) => decode(b).trimEnd()); + // Known error we can ignore + if (error.includes("'allow-unsafe-native-code-during-evaluation'")) { + // Extract the target sha256 out of the error + const target = " got: sha256:"; + const match = error + .split("\n") + .find((l) => l.includes(target)) + ?.split(target)[1]; + if (typeof match !== "undefined") { + return match; + } + } + throw new Error(error); } return cmd.output().then((b) => decode(b).trimEnd()); }; |