Compare commits

...

4 Commits

Author SHA1 Message Date
scpchicken edc422b1ce
Merge c54bd64372 into 1d55a41a2d 2025-02-09 03:49:18 +00:00
scpchicken c54bd64372 pkg(k-1.0.0): Added k 1.0.0 2025-02-08 20:42:07 -07:00
Omar Brikaa 1d55a41a2d
Explicitly provide env vars instead of inheriting them from parent (#703) 2025-02-08 20:46:46 +02:00
Omar Brikaa 6ef0cdf7b4
Provide HOME in sandbox (#702) 2025-02-08 15:10:50 +02:00
8 changed files with 30 additions and 14 deletions

View File

@ -156,7 +156,11 @@ class Job {
'-s',
'-c',
'/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=/etc:noexec`,
`--processes=${this.runtime.max_process_count}`,
@ -175,10 +179,6 @@ class Job {
...args,
],
{
env: {
...this.runtime.env_vars,
PISTON_LANGUAGE: this.runtime.language,
},
stdio: 'pipe',
}
);

View File

@ -178,15 +178,7 @@ 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')
.map(line => line.split('=', 2))
.forEach(([key, val]) => {
this._env_vars[key.trim()] = val.trim();
});
this._env_vars = env_content.trim().split('\n');
}
return this._env_vars;

9
packages/k/1.0.0/build.sh vendored Normal file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -e
git clone "https://codeberg.org/ngn/k" k
cd k
git checkout 544d014afd8dd84b18c2011cabd3aa3d76571ca3
make CC=gcc

5
packages/k/1.0.0/environment vendored Normal file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
# k path
export PATH=$PWD/bin:$PATH
export K_PATH=$PWD/k

5
packages/k/1.0.0/metadata.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"language": "k",
"version": "1.0.0",
"aliases": ["ngnk"]
}

3
packages/k/1.0.0/run vendored Normal file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
$K_PATH/k "$@"

1
packages/k/1.0.0/test.k vendored Normal file
View File

@ -0,0 +1 @@
`0:`c$2/'((1 0 0 1 1 1 1);(1 0 0 1 0 1 1))

View File

@ -404,6 +404,7 @@ Errors may return status codes as follows:
`javascript`,
`jelly`,
`julia`,
`k`,
`kotlin`,
`lisp`,
`llvm_ir`,