Merge branch 'master' into add-hy-1.0a4

This commit is contained in:
Thomas Hobson 2022-10-15 22:14:07 +13:00 committed by GitHub
commit fc33860983
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 138 additions and 17 deletions

View File

@ -35,6 +35,7 @@ expressWs(app);
}
}
});
fss.chmodSync(path.join(config.data_directory, globals.data_directories.jobs), 0o711)
logger.info('Loading packages');
const pkgdir = path.join(

View File

@ -343,6 +343,9 @@ class Job {
const [_1, state, user_friendly] = state_line.split(/\s+/);
const proc_id_int = parse_int(proc_id);
// Skip over any processes that aren't ours.
if(ruid != this.uid && euid != this.uid) return -1;
if (state == 'Z'){
// Zombie process, just needs to be waited, regardless of the user id
@ -353,8 +356,7 @@ class Job {
}
// We should kill in all other state (Sleep, Stopped & Running)
if (ruid == this.uid || euid == this.uid)
return proc_id_int;
return proc_id_int;
} catch {
return -1;
}
@ -384,7 +386,7 @@ class Job {
// Then clear them out of the process tree
try {
process.kill(proc, 'SIGKILL');
} catch {
} catch(e) {
// Could already be dead and just needs to be waited on
this.logger.debug(
`Got error while SIGKILLing process ${proc}:`,

View File

@ -10,11 +10,11 @@ services:
ports:
- 2000:2000
volumes:
- ./data/piston:/piston
- ./data/piston/packages:/piston/packages
environment:
- PISTON_REPO_URL=http://repo:8000/index
tmpfs:
- /piston/jobs:exec
- /piston/jobs:exec,uid=1000,gid=1000,mode=711
repo: # Local testing of packages
build: repo

View File

@ -8,7 +8,7 @@ services:
ports:
- 2000:2000
volumes:
- ./data/piston:/piston
- ./data/piston/packages:/piston/packages
tmpfs:
- /piston/jobs:exec,uid=1000,gid=1000,mode=700
- /piston/jobs:exec,uid=1000,gid=1000,mode=711
- /tmp:exec

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

@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -e
git clone "https://github.com/dzaima/CBQN" bqn
cd bqn
git checkout 88f65850fa6ac28bc50886c5942652f21d5be924
make CC=gcc

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

@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Python and Vyxal path
export PATH=$PWD/bin:$PATH
export BQN_PATH=$PWD/bqn

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

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

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

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

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

@ -0,0 +1 @@
•Out @+(+(2×)´¨)(-'0') "01001111""01001011"

5
packages/rust/1.62.0/build.sh vendored Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
curl -OL "https://static.rust-lang.org/dist/rust-1.62.0-x86_64-unknown-linux-gnu.tar.gz"
tar xzvf rust-1.62.0-x86_64-unknown-linux-gnu.tar.gz
rm rust-1.62.0-x86_64-unknown-linux-gnu.tar.gz

6
packages/rust/1.62.0/compile vendored Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
# https://stackoverflow.com/questions/38041331/rust-compiler-cant-find-crate-for-std
# Rust compiler needs to find the stdlib to link against
rustc -o binary -L ${RUST_INSTALL_LOC}/rustc/lib -L ${RUST_INSTALL_LOC}/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib "$@"
chmod +x binary

5
packages/rust/1.62.0/environment vendored Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Put 'export' statements here for environment variables
export PATH=$PWD/rust-1.62.0-x86_64-unknown-linux-gnu/rustc/bin/:$PATH
export RUST_INSTALL_LOC=$PWD/rust-1.62.0-x86_64-unknown-linux-gnu

7
packages/rust/1.62.0/metadata.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
"language": "rust",
"version": "1.62.0",
"aliases": [
"rs"
]
}

4
packages/rust/1.62.0/run vendored Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
shift
./binary "$@"

3
packages/rust/1.62.0/test.rs vendored Normal file
View File

@ -0,0 +1,3 @@
fn main() {
println!("OK");
}

5
packages/rust/1.63.0/build.sh vendored Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
curl -OL "https://static.rust-lang.org/dist/rust-1.63.0-x86_64-unknown-linux-gnu.tar.gz"
tar xzvf rust-1.63.0-x86_64-unknown-linux-gnu.tar.gz
rm rust-1.63.0-x86_64-unknown-linux-gnu.tar.gz

6
packages/rust/1.63.0/compile vendored Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
# https://stackoverflow.com/questions/38041331/rust-compiler-cant-find-crate-for-std
# Rust compiler needs to find the stdlib to link against
rustc -o binary -L ${RUST_INSTALL_LOC}/rustc/lib -L ${RUST_INSTALL_LOC}/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib "$@"
chmod +x binary

5
packages/rust/1.63.0/environment vendored Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Put 'export' statements here for environment variables
export PATH=$PWD/rust-1.63.0-x86_64-unknown-linux-gnu/rustc/bin/:$PATH
export RUST_INSTALL_LOC=$PWD/rust-1.63.0-x86_64-unknown-linux-gnu

7
packages/rust/1.63.0/metadata.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
"language": "rust",
"version": "1.63.0",
"aliases": [
"rs"
]
}

4
packages/rust/1.63.0/run vendored Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
shift
./binary "$@"

7
packages/rust/1.63.0/test.rs vendored Normal file
View File

@ -0,0 +1,7 @@
fn main() {
println!("OK");
// 1.63.0 features
use std::sync::Mutex;
const _M: Mutex<()> = Mutex::new(());
}

View File

@ -4,5 +4,5 @@ code_file=`pwd`/"$1"
shift
cd $SMALLTALK_PATH
$SMALLTALK_PATH/gst "$code_file" "$@"
$SMALLTALK_PATH/gst "$code_file" -a "$@"

10
packages/zig/0.9.1/build.sh vendored Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
mkdir -p bin
cd bin/
curl -L "https://ziglang.org/download/0.9.1/zig-linux-x86_64-0.9.1.tar.xz" -o zig.tar.xz
tar xf zig.tar.xz --strip-components=1
rm zig.tar.xz
cd ../

6
packages/zig/0.9.1/compile vendored Normal file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
# optimizing for small programs
rename 's/$/\.zig/' "$@" # Add .zig extension
zig build-exe -O ReleaseSafe --color off --cache-dir . --global-cache-dir . --name out *.zig

4
packages/zig/0.9.1/environment vendored Normal file
View File

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

8
packages/zig/0.9.1/metadata.json vendored Normal file
View File

@ -0,0 +1,8 @@
{
"language": "zig",
"version": "0.9.1",
"aliases": ["zig"],
"limit_overrides": {
"compile_timeout": 15000
}
}

4
packages/zig/0.9.1/run vendored Normal file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
shift # Filename is only used in compile step, so we can take it out here
./out "$@"

6
packages/zig/0.9.1/test.zig vendored Normal file
View File

@ -0,0 +1,6 @@
const std = @import("std");
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
try stdout.print("OK\n", .{});
}

9
piston
View File

@ -14,13 +14,6 @@ docker_compose(){
fi
}
init_precommit() {
if [ $PISTON_ENV == "dev" ]; then
rm -f .git/hooks/pre-commit
ln -s "$PISTON_PATH/pre-commit" "$PISTON_PATH/.git/hooks/pre-commit"
fi
}
case $1 in
help)
echo "=== Piston Management ==="
@ -66,14 +59,12 @@ case $1 in
restart) docker_compose restart ;;
start)
init_precommit
docker_compose up -d
;;
stop) docker_compose down ;;
bash) docker_compose exec api /bin/bash ;;
rebuild)
init_precommit
docker_compose build && docker_compose up -d
;;

View File

@ -71,6 +71,7 @@ The following are approved and endorsed extensions/utilities to the core Piston
- [Pyston](https://github.com/ffaanngg/pyston), a Python wrapper for accessing the Piston API.
- [Go-Piston](https://github.com/milindmadhukar/go-piston), a Golang wrapper for accessing the Piston API.
- [piston_rs](https://github.com/Jonxslays/piston_rs), a Rust wrapper for accessing the Piston API.
- [piston_rspy](https://github.com/Jonxslays/piston_rspy), Python bindings for accessing the Piston API via `piston_rs`.
<br>
@ -312,6 +313,7 @@ Content-Type: application/json
`befunge93`,
`brachylog`,
`brainfuck`,
`bqn`,
`c`,
`c++`,
`cjam`,