Skip to content

Commit cd906d2

Browse files
committed
Try setting these darn envs for Deno sandboxing
1 parent 06ba0db commit cd906d2

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

feat/dependencies-of/compute.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ModuleGraphJson, SubProcess, trace } from "../../deps.ts";
2+
import { defaultEnv } from "../../lib/env.ts";
23
import { computeDependencies } from "../../lib/module-map.ts";
34

45
const tracer = trace.getTracer('dependencies-of')
@@ -12,7 +13,10 @@ export async function computeGraph(
1213

1314
const downloadData = JSON.parse(await new SubProcess('download', {
1415
cmd: ["deno", "info", "--json", "--allow-import", "--", modUrl],
15-
env: { "NO_COLOR": "yas" },
16+
env: {
17+
...defaultEnv,
18+
"NO_COLOR": "yas",
19+
},
1620
stdin: 'null',
1721
errorPrefix: /^error: /,
1822
}).captureAllTextOutput()) as ModuleGraphJson;
@@ -31,7 +35,7 @@ export async function renderGraph(modUrl: string, dotArgs: string[], args: URLSe
3135

3236
const dotProc = new SubProcess('render', {
3337
cmd: ["dot", ...dotArgs],
34-
env: { },
38+
env: defaultEnv,
3539
stdin: 'piped',
3640
errorPrefix: /^Error: /,
3741
});

feat/shields/api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { CodeModule } from "../../lib/types.ts";
55
import { resolveModuleUrl } from "../../lib/resolve.ts";
66
import { processDenoInfo, ModuleMap } from "../../lib/module-map.ts";
77
import { determineModuleAttrs } from "../../lib/module-registries.ts";
8+
import { defaultEnv } from "../../lib/env.ts";
89

910
export async function handleRequest(req: Request, shieldId: string, modSlug: string) {
1011
const modUrl = await resolveModuleUrl(modSlug);
@@ -45,7 +46,7 @@ export async function handleRequest(req: Request, shieldId: string, modSlug: str
4546
export async function computeGraph(modUrl: string) {
4647
const downloadData = await new SubProcess('download', {
4748
cmd: ["deno", "info", "--json", "--allow-import", "--", modUrl],
48-
env: { },
49+
env: defaultEnv,
4950
stdin: 'null',
5051
errorPrefix: /^error: /,
5152
}).captureAllTextOutput();

lib/env.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const defaultEnv = {
2+
"LD_LIBRARY_PATH": "",
3+
"LD_PRELOAD": "",
4+
"DYLD_FALLBACK_LIBRARY_PATH": "",
5+
};

0 commit comments

Comments
 (0)