mirror of
https://github.com/engineer-man/piston.git
synced 2025-04-20 20:16:26 +02:00
remove main
This commit is contained in:
parent
b3575246bd
commit
9814217aee
4 changed files with 5 additions and 16 deletions
|
@ -17,22 +17,15 @@ let gid = 0;
|
|||
|
||||
class Job {
|
||||
|
||||
constructor({ runtime, files, args, stdin, timeouts, main, alias }) {
|
||||
constructor({ runtime, files, args, stdin, timeouts, alias }) {
|
||||
this.uuid = uuidv4();
|
||||
this.runtime = runtime;
|
||||
this.files = files;
|
||||
this.args = args;
|
||||
this.stdin = stdin;
|
||||
this.timeouts = timeouts;
|
||||
this.main = main;
|
||||
this.alias = alias;
|
||||
|
||||
let file_list = this.files.map(f => f.name);
|
||||
|
||||
if (!file_list.includes(this.main)) {
|
||||
throw new Error(`Main file "${this.main}" will not be written to disk`);
|
||||
}
|
||||
|
||||
this.uid = config.runner_uid_min + uid;
|
||||
this.gid = config.runner_gid_min + gid;
|
||||
|
||||
|
@ -171,7 +164,7 @@ class Job {
|
|||
|
||||
const run = await this.safe_call(
|
||||
path.join(this.runtime.pkgdir, 'run'),
|
||||
[this.main, ...this.args],
|
||||
[this.files[0].name, ...this.args],
|
||||
this.timeouts.run
|
||||
);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// {"language":"python","version":"3.9.1","files":{"code.py":"print('hello world')"},"args":[],"stdin":"","compile_timeout":10, "run_timeout":3, "main": "code.py"}
|
||||
// {"language":"python","version":"3.9.1","files":{"code.py":"print('hello world')"},"args":[],"stdin":"","compile_timeout":10, "run_timeout":3}
|
||||
// {"success":true, "run":{"stdout":"hello world", "stderr":"", "error_code":0},"compile":{"stdout":"","stderr":"","error_code":0}}
|
||||
|
||||
const { get_latest_runtime_matching_language_version } = require('../runtime');
|
||||
|
@ -55,8 +55,7 @@ module.exports = {
|
|||
timeouts: {
|
||||
run: req.body.run_timeout,
|
||||
compile: req.body.compile_timeout
|
||||
},
|
||||
main: req.body.main
|
||||
}
|
||||
});
|
||||
|
||||
await job.prime();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue