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