Compare commits
4 Commits
955dea97fd
...
0080beeb97
Author | SHA1 | Date |
---|---|---|
|
0080beeb97 | |
|
1d55a41a2d | |
|
6ef0cdf7b4 | |
|
4581f3e966 |
|
@ -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;
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
curl "https://nodejs.org/dist/v22.4.0/node-v22.4.0-linux-x64.tar.xz" -o node.tar.xz
|
||||||
|
tar xf node.tar.xz --strip-components=1
|
||||||
|
rm node.tar.xz
|
|
@ -0,0 +1 @@
|
||||||
|
export PATH=$PWD/bin:$PATH
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"language": "node",
|
||||||
|
"version": "22.4.0",
|
||||||
|
"provides": [
|
||||||
|
{
|
||||||
|
"language": "javascript",
|
||||||
|
"aliases": ["node-javascript", "node-js", "javascript", "js"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
node "$@"
|
|
@ -0,0 +1 @@
|
||||||
|
console.log('OK');
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
source ../../node/22.4.0/build.sh
|
||||||
|
|
||||||
|
source ./environment
|
||||||
|
|
||||||
|
bin/npm install -g typescript@5.5.3
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Put instructions to compile source code, remove this file if the language does not require this stage
|
||||||
|
|
||||||
|
rename 's/$/\.ts/' "$@" # Add .ts extension
|
||||||
|
|
||||||
|
tsc *.ts
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Put 'export' statements here for environment variables
|
||||||
|
export PATH=$PWD/bin:$PATH
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"language": "typescript",
|
||||||
|
"version": "5.5.3",
|
||||||
|
"aliases": ["ts", "node-ts", "tsc", "typescript5", "ts5"]
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Put instructions to run the runtime
|
||||||
|
|
||||||
|
CODE=$1.js
|
||||||
|
shift
|
||||||
|
|
||||||
|
node $CODE "$@"
|
|
@ -0,0 +1 @@
|
||||||
|
console.log('OK');
|
Loading…
Reference in New Issue