Compare commits

..

1 commit

Author SHA1 Message Date
Kodie
7f55bed514
Merge c91b8645de into 4e361dcf92 2024-10-28 11:35:51 +13:00
2 changed files with 14 additions and 6 deletions

View file

@ -156,11 +156,7 @@ class Job {
'-s',
'-c',
'/box/submission',
'-E',
'HOME=/tmp',
...this.runtime.env_vars.flat_map(v => ['-E', v]),
'-E',
`PISTON_LANGUAGE=${this.runtime.language}`,
'-e',
`--dir=${this.runtime.pkgdir}`,
`--dir=/etc:noexec`,
`--processes=${this.runtime.max_process_count}`,
@ -179,6 +175,10 @@ class Job {
...args,
],
{
env: {
...this.runtime.env_vars,
PISTON_LANGUAGE: this.runtime.language,
},
stdio: 'pipe',
}
);

View file

@ -178,7 +178,15 @@ class Runtime {
const env_file = path.join(this.pkgdir, '.env');
const env_content = fss.read_file_sync(env_file).toString();
this._env_vars = env_content.trim().split('\n');
this._env_vars = {};
env_content
.trim()
.split('\n')
.map(line => line.split('=', 2))
.forEach(([key, val]) => {
this._env_vars[key.trim()] = val.trim();
});
}
return this._env_vars;