mirror of
https://github.com/engineer-man/piston.git
synced 2025-04-20 20:16:26 +02:00
Compare commits
1 commit
bbd0ff3dfa
...
7f55bed514
Author | SHA1 | Date | |
---|---|---|---|
|
7f55bed514 |
2 changed files with 14 additions and 6 deletions
|
@ -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',
|
||||
}
|
||||
);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue