piston improvements. adds version endpoint, new execution output, awk language support, and installs all dependencies directly when possible and avoids apt unless not possible

This commit is contained in:
Brian Seymour 2020-03-29 14:40:34 -05:00
parent f6af99bbee
commit 8fcdec7275
7 changed files with 143 additions and 85 deletions

View file

@ -42,17 +42,11 @@ exec 200>&-
bin=
case "$lang" in
"python2")
bin=python2
"awk")
bin=awk
;;
"python" | "python3")
bin=python3
;;
"ruby")
bin=ruby
;;
"javascript" | "js" | "node")
bin=node
"bash")
bin=bash
;;
"c")
bin=c
@ -60,29 +54,38 @@ case "$lang" in
"cpp" | "c++")
bin=cpp
;;
"go")
bin=go
;;
"c#" | "csharp" | "cs")
"csharp" | "cs" | "c#")
bin=csharp
;;
"php")
bin=php
;;
"nasm" | "asm")
bin=nasm
"go")
bin=go
;;
"java")
bin=java
;;
"swift")
bin=swift
"nasm" | "asm")
bin=nasm
;;
"node" | "js" | "javascript")
bin=node
;;
"php")
bin=php
;;
"python2")
bin=python2
;;
"python3" | "python")
bin=python3
;;
"ruby")
bin=ruby
;;
"rust")
bin=rust
;;
"bash")
bin=bash
"swift")
bin=swift
;;
"typescript" | "ts")
bin=typescript

4
lxc/executors/awk Executable file
View file

@ -0,0 +1,4 @@
cd /tmp/$2
timeout -s KILL 2 sed "/___code___/Q" code.code > code.stdin
timeout -s KILL 2 sed "1,/___code___/d" code.code > code.awk
runuser runner$1 -c "cd /tmp/$2 ; timeout -s KILL 3 awk -f code.awk < code.stdin"

View file

@ -1,5 +1,8 @@
#!/usr/bin/env bash
echo '---'
echo 'awk'
lxc-attach --clear-env -n piston -- /bin/bash -l -c "awk -W version"
echo '---'
echo 'bash'
lxc-attach --clear-env -n piston -- /bin/bash -l -c "bash --version"
echo '---'