This commit is contained in:
Brian Seymour 2020-06-04 19:17:26 -05:00
commit 30556fb45d
7 changed files with 36 additions and 2 deletions

View File

@ -70,6 +70,7 @@ func Execute(res http.ResponseWriter, req *http.Request) {
"c",
"cpp", "c++",
"csharp", "cs", "c#",
"elixir", "exs",
"go",
"java",
"julia", "jl",
@ -139,6 +140,8 @@ func launch(request Inbound, res http.ResponseWriter) {
execlang = "cpp"
case "cs", "c#":
execlang = "csharp"
case "elixir", "exs":
execlang = "elixir"
case "asm":
execlang = "nasm"
case "js", "javascript":

View File

@ -57,6 +57,9 @@ case "$lang" in
"csharp" | "cs" | "c#")
bin=csharp
;;
"elixir" | "exs")
bin=elixir
;;
"go")
bin=go
;;

2
lxc/executors/elixir Normal file
View File

@ -0,0 +1,2 @@
cd /tmp/$2
runuser runner$1 -c "cd /tmp/$2 ; cat args.args ; xargs -d '\n' timeout -s KILL 3 elixir code.code"

View File

@ -27,6 +27,9 @@ echo '---'
echo 'kotlin'
lxc-attach --clear-env -n piston -- /bin/bash -l -c "kotlinc -version"
echo '---'
echo "elixir"
lxc-attach --clear-env -n piston -- /bin/bash -l -c "elixir --version"
echo "---"
echo 'nasm'
lxc-attach --clear-env -n piston -- /bin/bash -l -c "nasm -version"
echo '---'

View File

@ -19,6 +19,9 @@ systemctl start libvirtd
# ubuntu server 18.04:
apt install lxc lxc-templates debootstrap libvirt0
# arch:
sudo pacman -S lxc libvirt unzip
# everything else:
# not documented, please open pull requests with commands for debian/arch/macos
@ -145,8 +148,8 @@ tar -xzf julia-1.4.1-linux-x86_64.tar.gz
echo 'export PATH=$PATH:/opt/julia/julia-1.4.1/bin' >> /opt/.profile
source /opt/.profile
#install kotlin
#final binary: /opt/kotlinc/bin/kotlinc
# install kotlin
# final binary: /opt/kotlinc/bin/kotlinc
cd /opt
wget https://github.com/JetBrains/kotlin/releases/download/v1.3.72/kotlin-compiler-1.3.72.zip
unzip kotlin-compiler-1.3.72.zip
@ -154,6 +157,23 @@ rm kotlin-compiler-1.3.72.zip
echo 'export PATH=$PATH:/opt/kotlinc/bin' >> /opt/.profile
source /opt/.profile
# install elixir and erlang
# final binary: /opt/elixir/bin/elixir --version
# erlang
cd /opt && mkdir erlang && cd erlang
wget http://erlang.org/download/otp_src_23.0.tar.gz
gunzip -c otp_src_23.0.tar.gz | tar xf -
cd otp_src_23.0 && ./configure
make
echo 'export PATH=$PATH:/opt/erlang/otp_src_23.0/bin' >> /opt/.profile
source /opt/.profile
# elixir
cd /opt && mkdir elixir && cd elixir
wget https://github.com/elixir-lang/elixir/releases/download/v1.10.3/Precompiled.zip
mkdir elixir-1.10.3 && unzip Precompiled.zip -d elixir-1.10.3/
echo 'export PATH=$PATH:/opt/elixir/elixir-1.10.3/bin' >> /opt/.profile
source /opt/.profile
# create runnable users and apply limits
for i in {1..150}; do
useradd -M runner$i

1
tests/test.exs Normal file
View File

@ -0,0 +1 @@
IO.puts("good")

View File

@ -8,6 +8,8 @@ echo 'testing cpp'
../lxc/execute cpp test.cpp
echo 'testing cs'
../lxc/execute cs test.cs
echo 'testing elixir'
../lxc/exexute exs test.exs
echo 'testing go'
../lxc/execute go test.go
echo 'testing java'