Merge pull request #498 from Brikaa/merge-master

Merge master into nix-packages and fix conflicts
This commit is contained in:
Thomas Hobson 2022-08-15 08:07:21 +12:00 committed by GitHub
commit b98b208d0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 214 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');

View File

@ -152,12 +152,17 @@ class Job {
'--fsize=' + this.runtime.max_file_size,
];
const timeout_call = [
'timeout', '-s', '9', Math.ceil(timeout / 1000),
];
if (memory_limit >= 0) {
prlimit.push('--as=' + memory_limit);
}
const proc_call = [
'nice',
...timeout_call,
...prlimit,
...nonetwork,
'bash',
@ -362,13 +367,21 @@ class Job {
const [_1, state, user_friendly] = state_line.split(/\s+/);
if (state == 'Z')
// Zombie process, just needs to be waited
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
if(!to_wait.includes(proc_id_int))
to_wait.push(proc_id_int);
return -1;
}
// We should kill in all other state (Sleep, Stopped & Running)
if (ruid == this.uid || euid == this.uid)
return parse_int(proc_id);
return proc_id_int;
} catch {
return -1;
}

View File

@ -246,11 +246,12 @@ async function run_non_interactively(files, argv) {
exports.handler = async argv => {
const files = [...(argv.files || []), argv.file].map(file_path => {
const buffer = fs.readFileSync(file_path);
// Checks for <20> (the replacement character) after encoding the buffer to uf8
const encoding =
(buffer
.toString()
.split('')
.some(x => x.charCodeAt(0) >= 128) &&
.some(x => x.charCodeAt(0) === 65533) &&
'base64') ||
'utf8';
return {

24
cli/package-lock.json generated
View File

@ -19,9 +19,9 @@
}
},
"node_modules/ansi-regex": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"engines": {
"node": ">=8"
}
@ -116,9 +116,9 @@
}
},
"node_modules/follow-redirects": {
"version": "1.14.3",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.3.tgz",
"integrity": "sha512-3MkHxknWMUtb23apkgz/83fDoe+y+qr0TdgacGIA7bew+QLBo3vdgEN2xEsuXNivpFy4CyDhBBZnNZOtalmenw==",
"version": "1.14.8",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.8.tgz",
"integrity": "sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==",
"funding": [
{
"type": "individual",
@ -316,9 +316,9 @@
},
"dependencies": {
"ansi-regex": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg=="
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="
},
"ansi-styles": {
"version": "4.3.0",
@ -398,9 +398,9 @@
"integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw=="
},
"follow-redirects": {
"version": "1.14.3",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.3.tgz",
"integrity": "sha512-3MkHxknWMUtb23apkgz/83fDoe+y+qr0TdgacGIA7bew+QLBo3vdgEN2xEsuXNivpFy4CyDhBBZnNZOtalmenw=="
"version": "1.14.8",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.8.tgz",
"integrity": "sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA=="
},
"get-caller-file": {
"version": "2.0.5",

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"

15
packages/emojicode/1.0.2/build.sh vendored Normal file
View File

@ -0,0 +1,15 @@
curl -L https://github.com/emojicode/emojicode/releases/download/v1.0-beta.2/Emojicode-1.0-beta.2-Linux-x86_64.tar.gz -o emoji.tar.gz
tar xzf emoji.tar.gz
mv Emojicode-1.0-beta.2-Linux-x86_64 emoji
rm emoji.tar.gz
cd emoji
./install.sh
chmod +x emojicodec
cd ..

4
packages/emojicode/1.0.2/compile vendored Normal file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
"$EMOJI_PATH"/emojicodec -S "$EMOJI_PATH"/packages "$1" -o "bruh.exe"
chmod +x "bruh.exe"

5
packages/emojicode/1.0.2/environment vendored Normal file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Put 'export' statements here for environment variables
export PATH=$PWD/bin:$PATH
export EMOJI_PATH=$PWD/emoji

View File

@ -0,0 +1,7 @@
{
"language": "emojicode",
"version": "1.0.2",
"aliases": [
"emojic"
]
}

5
packages/emojicode/1.0.2/run vendored Normal file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
shift
./"bruh.exe" "$@"

3
packages/emojicode/1.0.2/test.emojic vendored Normal file
View File

@ -0,0 +1,3 @@
🏁 🍇
😀 🔤OK🔤❗
🍉

12
packages/forth/0.7.3/build.sh vendored Normal file
View File

@ -0,0 +1,12 @@
curl -L https://ftp.gnu.org/gnu/gforth/gforth-0.7.3.tar.gz -o forth.tar.gz
tar xzf forth.tar.gz
rm forth.tar.gz
cd gforth-0.7.3/
./BUILD-FROM-SCRATCH --host=x86_64 --build=x86_64
make
make install
chmod +x ./gforth
cd ..

5
packages/forth/0.7.3/environment vendored Normal file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Put 'export' statements here for environment variables
export PATH=$PWD/bin:$PATH
export FORTH_PATH=$PWD/gforth-0.7.3

7
packages/forth/0.7.3/metadata.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
"language": "forth",
"version": "0.7.3",
"aliases": [
"gforth"
]
}

4
packages/forth/0.7.3/run vendored Normal file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
$FORTH_PATH/gforth "$@"

1
packages/forth/0.7.3/test.forth vendored Normal file
View File

@ -0,0 +1 @@
.( OK) bye

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.56.1",
"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");
}

19
packages/smalltalk/3.2.3/build.sh vendored Normal file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -e
curl -L https://ftp.gnu.org/gnu/smalltalk/smalltalk-3.2.3.tar.gz -o smalltalk-3.2.3.tar.gz
tar xzf smalltalk-3.2.3.tar.gz
rm smalltalk-3.2.3.tar.gz
cd smalltalk-3.2.3
./configure
rm libc.la
make
make install
chmod +x gst
cd ..

5
packages/smalltalk/3.2.3/environment vendored Normal file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Put 'export' statements here for environment variables
export PATH=$PWD/bin:$PATH
export SMALLTALK_PATH=$PWD/smalltalk-3.2.3

View File

@ -0,0 +1,5 @@
{
"language": "smalltalk",
"version": "3.2.3",
"aliases": ["st"]
}

8
packages/smalltalk/3.2.3/run vendored Normal file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
code_file=`pwd`/"$1"
shift
cd $SMALLTALK_PATH
$SMALLTALK_PATH/gst "$code_file" -a "$@"

1
packages/smalltalk/3.2.3/test.st vendored Normal file
View File

@ -0,0 +1 @@
'OK' display

19
packages/sqlite3/3.36.0/run vendored Normal file
View File

@ -0,0 +1,19 @@
#!/bin/bash
code=`cat "$1"`
shift
argv_text=""
for arg in "$@"
do
argv_text+='insert into argv (arg) values ("'"`echo "$arg" | sed 's/"/""/g'`"'");
'
done
sqlite3 <<< "create table argv (arg text);
$argv_text
$code"

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>
@ -311,6 +312,7 @@ Content-Type: application/json
`befunge93`,
`brachylog`,
`brainfuck`,
`bqn`,
`c`,
`c++`,
`cjam`,
@ -327,6 +329,7 @@ Content-Type: application/json
`dragon`,
`elixir`,
`emacs`,
`emojicode`,
`erlang`,
`file`,
`forte`,
@ -378,6 +381,7 @@ Content-Type: application/json
`ruby`,
`rust`,
`scala`,
`smalltalk`,
`sqlite3`,
`swift`,
`typescript`,