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
9 changed files with 17 additions and 24 deletions

View file

@ -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',
} }
); );

View file

@ -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;

2
packages/ngnk/1.0.0/build.sh → packages/k/1.0.0/build.sh vendored Executable file → Normal file
View file

@ -5,5 +5,5 @@ set -e
git clone "https://codeberg.org/ngn/k" k git clone "https://codeberg.org/ngn/k" k
cd k cd k
git checkout 040f73b56f379a8298cb1747075c9e947dfe0e42 git checkout 544d014afd8dd84b18c2011cabd3aa3d76571ca3
make CC=gcc make CC=gcc

View file

@ -1,4 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# k path
export PATH=$PWD/bin:$PATH export PATH=$PWD/bin:$PATH
export K_PATH=$PWD/k 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"]
}

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

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

View file

@ -1 +0,0 @@
`0:"OK"