diff --git a/api/src/index.js b/api/src/index.js index d628ba1..d9a5cae 100644 --- a/api/src/index.js +++ b/api/src/index.js @@ -20,7 +20,7 @@ app.post( errorMessage: 'Supplied language is not a string', }, custom: { - options: value => languages.find(language => language.aliases.includes(value?.toLowerCase())), + options: value => value && languages.find(language => language.aliases.includes(value.toLowerCase())), errorMessage: 'Supplied language is not supported by Piston', }, }, diff --git a/lxc/execute b/lxc/execute index 3438547..29c445b 100755 --- a/lxc/execute +++ b/lxc/execute @@ -45,13 +45,17 @@ timeout -s KILL 20 \ # process janitor lxc-attach --clear-env -n piston -- \ - /bin/bash -l -c "\ - for i in {1..100}; do pkill -u runner$newinc --signal SIGKILL; done ;\ - find /tmp -user runner$newinc -exec /bin/rm -rf {} \; ;\ - find /var/tmp -user runner$newinc -exec /bin/rm -rf {} \; ;\ - find /var/lock -user runner$newinc -exec /bin/rm -rf {} \; ;\ - find /dev/shm -user runner$newinc -exec /bin/rm -rf {} \; ;\ - find /run/lock -user runner$newinc -exec /bin/rm -rf {} \; ;\ - " > /dev/null 2>&1 & + /bin/bash -l -c " + for i in {1..100} + do + pkill -u runner$newinc --signal SIGKILL + done + + find /tmp -user runner$newinc -delete + find /var/tmp -user runner$newinc -delete + find /var/lock -user runner$newinc -delete + find /dev/shm -user runner$newinc -delete + find /run/lock -user runner$newinc -delete + " > /dev/null 2>&1 & rm -rf $basepath/tmp/$epoch diff --git a/lxc/executors/paradoc b/lxc/executors/paradoc index 33fe880..08e6e2c 100755 --- a/lxc/executors/paradoc +++ b/lxc/executors/paradoc @@ -1,2 +1,6 @@ -cd /tmp/$2 -runuser runner$1 -c "cd /tmp/$2 ; timeout -s KILL 3 python3 -m paradoc code.code <<< args.args" +#!/bin/bash + +runuser runner$1 -c " + cd /tmp/$2 + timeout -s KILL 3 python3 -m paradoc code.code < args.args +" diff --git a/lxc/executors/rust b/lxc/executors/rust index 2a70609..9dc32ea 100755 --- a/lxc/executors/rust +++ b/lxc/executors/rust @@ -1,9 +1,7 @@ #!/bin/bash -cd /tmp/$2 -rustc -o binary code.code - runuser runner$1 -c " cd /tmp/$2 + rustc -o binary code.code timeout -s KILL 3 xargs -a args.args -d '\n' ./binary < stdin.stdin "