Skip to content

Commit 6622fb4

Browse files
committed
Don't overwrite process.env in safe_call, test.js packages
1 parent 5cf1545 commit 6622fb4

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

api/src/bin/test.js

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ const { Job } = require('../job');
7070
run: config.run_memory_limit,
7171
compile: config.compile_memory_limit,
7272
},
73+
packages: test.packages || [],
7374
});
7475

7576
await job.prime();

api/src/job.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ class Job {
188188
proc_info.gid = this.gid;
189189
}
190190
if (options.env) {
191-
proc_info.env = options.env;
191+
proc_info.env = { ...process.env, ...options.env };
192192
}
193193
const proc = cp.spawn(proc_call[0], proc_call.splice(1), {
194194
stdio: 'pipe',
@@ -291,7 +291,9 @@ class Job {
291291
const env = {};
292292
if (install && install.stdout !== '' && install.code === 0) {
293293
const install_json = JSON.parse(install.stdout);
294-
env.PISTON_PACKAGES_PATH = install_json.map(i => i.outputs.out).join(':');
294+
env.PISTON_PACKAGES_PATH = install_json
295+
.map(i => i.outputs.out)
296+
.join(':');
295297
}
296298

297299
const code_files = this.files.filter(file => file.encoding == 'utf8');

0 commit comments

Comments
 (0)