Compare commits
4 Commits
0d9b87c5a8
...
cb489889d6
Author | SHA1 | Date |
---|---|---|
|
cb489889d6 | |
|
1d55a41a2d | |
|
6ef0cdf7b4 | |
|
1f36b3d350 |
|
@ -156,7 +156,11 @@ 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}`,
|
||||||
|
@ -175,10 +179,6 @@ class Job {
|
||||||
...args,
|
...args,
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
env: {
|
|
||||||
...this.runtime.env_vars,
|
|
||||||
PISTON_LANGUAGE: this.runtime.language,
|
|
||||||
},
|
|
||||||
stdio: 'pipe',
|
stdio: 'pipe',
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -178,15 +178,7 @@ 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 = {};
|
this._env_vars = env_content.trim().split('\n');
|
||||||
|
|
||||||
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;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.21.2",
|
"axios": "^0.21.2",
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
"minimatch": "^3.0.4",
|
"minimatch": "^3.0.5",
|
||||||
"nocamel": "^1.0.2",
|
"nocamel": "^1.0.2",
|
||||||
"semver": "^7.3.5",
|
"semver": "^7.3.5",
|
||||||
"ws": "^7.5.3",
|
"ws": "^7.5.3",
|
||||||
|
@ -170,9 +170,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/minimatch": {
|
"node_modules/minimatch": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.5.tgz",
|
||||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
"integrity": "sha512-tUpxzX0VAzJHjLu0xUfFv1gwVp9ba3IOuRAVH2EGuRW8a5emA2FlACLqiT/lDVtS1W+TGNwqz3sWaNyLgDJWuw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
},
|
},
|
||||||
|
@ -426,9 +426,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"minimatch": {
|
"minimatch": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.5.tgz",
|
||||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
"integrity": "sha512-tUpxzX0VAzJHjLu0xUfFv1gwVp9ba3IOuRAVH2EGuRW8a5emA2FlACLqiT/lDVtS1W+TGNwqz3sWaNyLgDJWuw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.21.2",
|
"axios": "^0.21.2",
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
"minimatch": "^3.0.4",
|
"minimatch": "^3.0.5",
|
||||||
"nocamel": "^1.0.2",
|
"nocamel": "^1.0.2",
|
||||||
"semver": "^7.3.5",
|
"semver": "^7.3.5",
|
||||||
"ws": "^7.5.3",
|
"ws": "^7.5.3",
|
||||||
|
|
Loading…
Reference in New Issue