Compare commits

...

4 Commits

Author SHA1 Message Date
Amarjeet Anand 9d823010e7
Merge 42d5e3e32f into 1d55a41a2d 2025-02-11 21:34:08 +00: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
Amarjeet Anand 42d5e3e32f add go 1.22.2 pkg 2024-04-28 19:11:31 +05:30
7 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;

4
packages/go/1.22.2/build.sh vendored Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
curl -LO https://go.dev/dl/go1.22.2.linux-amd64.tar.gz
tar -xzf go1.22.2.linux-amd64.tar.gz
rm go1.22.2.linux-amd64.tar.gz

2
packages/go/1.22.2/environment vendored Normal file
View File

@ -0,0 +1,2 @@
export PATH=$PWD/go/bin:$PATH
export GOPATH=$PWD/gopath

5
packages/go/1.22.2/metadata.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"language": "go",
"version": "1.22.2",
"aliases": ["go", "golang"]
}

6
packages/go/1.22.2/run vendored Normal file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
mv $1 $1.go
filename=*.go
shift
GOCACHE=$PWD go run $filename "$@"

7
packages/go/1.22.2/test.go vendored Normal file
View File

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("OK")
}