Compare commits

..

1 commit

Author SHA1 Message Date
Cory
2d595f1acf
Merge c44fc86087 into 4e361dcf92 2024-10-13 13:46:56 +05:30
2 changed files with 14 additions and 6 deletions

View file

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

View file

@ -178,7 +178,15 @@ class Runtime {
const env_file = path.join(this.pkgdir, '.env'); const env_file = path.join(this.pkgdir, '.env');
const env_content = fss.read_file_sync(env_file).toString(); 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; return this._env_vars;