fix jelly, move all executor code to runner permission, introduce stdout/stderr separate output to the api

This commit is contained in:
Brian Seymour 2021-01-13 23:45:48 -06:00
parent 15b6f6e8d6
commit b81690a9de
18 changed files with 101 additions and 41 deletions

View file

@ -1,4 +1,4 @@
runuser runner$1 -c "\
cd /tmp/$2 ; \
timeout -s KILL 10 gcc -std=c11 -o binary -x c code.code ; \
gcc -std=c11 -o binary -x c code.code ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"

View file

@ -1,3 +1,4 @@
cd /tmp/$2
timeout -s KILL 10 g++ -std=c++17 -o binary -x c++ code.code
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"
runuser runner$1 -c "\
cd /tmp/$2 ; \
g++ -std=c++17 -o binary -x c++ code.code ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"

View file

@ -1,3 +1,4 @@
cd /tmp/$2
timeout -s KILL 10 mcs $(echo code.code | sed 's/\///') -nowarn:0219 -out:binary
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 mono binary"
runuser runner$1 -c "\
cd /tmp/$2 ; \
mcs $(echo code.code | sed 's/\///') -nowarn:0219 -out:binary ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 mono binary"

View file

@ -1,7 +1,7 @@
cd /tmp/$2
if [[ -z $(grep '[^[:space:]]' args.args) ]]; then
runuser -l runner$1 -c "cd /tmp/$2 ; timeout -s KILL 3 emacs -Q --script code.code"
runuser runner$1 -c "cd /tmp/$2 ; timeout -s KILL 3 emacs -Q --script code.code"
else
runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 emacs -Q --script code.code"
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 emacs -Q --script code.code"
fi

View file

@ -1,6 +1,6 @@
cd /tmp/$2
cp code.code interim.go
file="interim.go"
timeout -s KILL 10 go build $file
go build $file
file=${file%%.*}
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./$file"

View file

@ -1,4 +1,7 @@
cd /tmp/$2
mv code.code code.hs
timeout -s KILL 10 ghc -dynamic -o binary code.hs > /dev/null 2>&1
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"
runuser runner$1 -c "\
cd /tmp/$2 ; \
ghc -dynamic -o binary code.hs > /dev/null 2>&1 ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"

View file

@ -2,5 +2,8 @@ cd /tmp/$2
cp code.code interim.java
name=$(grep -Po "(?<=\n|\A)\s*(public\s+)?(class|interface)\s+\K([^\n\s{]+)" interim.java)
mv interim.java $name.java
timeout -s KILL 10 javac $name.java
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 java $name"
runuser runner$1 -c "\
cd /tmp/$2 ; \
javac $name.java ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 java $name"

View file

@ -1,4 +1,6 @@
cd /tmp/$2
cp code.code code.kt
timeout -s KILL 10 kotlinc code.kt -include-runtime -d code.jar
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 java -jar code.jar"
runuser runner$1 -c "\
cd /tmp/$2 ; \
kotlinc code.kt -include-runtime -d code.jar ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 java -jar code.jar"

View file

@ -1,4 +1,5 @@
cd /tmp/$2
timeout -s KILL 10 nasm -f elf32 -o binary.o code.code
timeout -s KILL 10 ld -m elf_i386 binary.o -o binary
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"
runuser runner$1 -c "\
cd /tmp/$2 ; \
nasm -f elf32 -o binary.o code.code ; \
ld -m elf_i386 binary.o -o binary ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"

View file

@ -1,4 +1,5 @@
cd /tmp/$2
timeout -s KILL 10 nasm -f elf64 -o binary.o code.code
timeout -s KILL 10 ld -m elf_x86_64 binary.o -o binary
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"
runuser runner$1 -c "\
cd /tmp/$2 ; \
nasm -f elf64 -o binary.o code.code ; \
ld -m elf_x86_64 binary.o -o binary ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"

View file

@ -1,3 +1,5 @@
cd /tmp/$2
timeout -s KILL 10 rustc -o binary code.code
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"
rustc -o binary code.code
runuser runner$1 -c "\
cd /tmp/$2 ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary"

View file

@ -1,6 +1,7 @@
cd /tmp/$2
mv code.code interim.ts
timeout -s KILL 10 tsc interim.ts
rm interim.ts
mv interim.js code.code
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 node code.code"
runuser runner$1 -c "\
cd /tmp/$2 ; \
mv code.code interim.ts ; \
tsc interim.ts ; \
rm -f interim.ts ; \
mv interim.js code.code ; \
cat args.args | xargs -d '\n' timeout -s KILL 3 node code.code"