Add Crystal

This commit is contained in:
Vrganj 2021-01-04 20:52:46 +01:00
parent b0c462d5ee
commit 10d85553db
7 changed files with 26 additions and 0 deletions

View file

@ -70,6 +70,7 @@ func Execute(res http.ResponseWriter, req *http.Request) {
"brainfuck", "bf",
"c",
"cpp", "c++",
"crystal", "cr",
"csharp", "cs", "c#",
"deno", "denojs", "denots",
"elixir", "exs",
@ -150,6 +151,8 @@ func launch(request Inbound, res http.ResponseWriter) {
execlang = "brainfuck"
case "c++":
execlang = "cpp"
case "cr":
execlang = "crystal"
case "cs", "c#":
execlang = "csharp"
case "denojs", "denots":

View file

@ -57,6 +57,9 @@ case "$lang" in
"cpp" | "c++")
bin=cpp
;;
"crystal" | "cr")
bin=crystal
;;
"csharp" | "cs" | "c#")
bin=csharp
;;

3
lxc/executors/crystal Normal file
View file

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

View file

@ -7,6 +7,8 @@ echo 'testing c'
../execute c test.c
echo 'testing cpp'
../execute cpp test.cpp
echo 'testing crystal'
../execute crystal test.cr
echo 'testing cs'
../execute cs test.cs
echo 'testing deno ts'

1
lxc/tests/test.cr Normal file
View file

@ -0,0 +1 @@
puts "good"

View file

@ -21,6 +21,10 @@ echo 'cpp'
lxc-attach --clear-env -n piston -- /bin/bash -l -c "g++ -v"
echo '---'
echo 'crystal'
lxc-attach --clear-env -n piston -- /bin/bash -l -c "crystal -v"
echo '---'
echo 'csharp'
lxc-attach --clear-env -n piston -- /bin/bash -l -c "mcs --version"
echo '---'

View file

@ -261,6 +261,15 @@ cd nim-1.4.0
echo 'export PATH=$PATH:/opt/nim/bin' >> /opt/.profile
source /opt/.profile
# install crystal
# final binary: /opt/crystal/crystal-0.35.1-1/bin/crystal
# get version: /opt/crystal/crystal-0.35.1-1/bin/crystal -v
cd /opt && mkdir crystal && cd crystal
wget https://github.com/crystal-lang/crystal/releases/download/0.35.1/crystal-0.35.1-1-linux-x86_64.tar.gz
tar -xzf crystal-0.35.1-1-linux-x86_64.tar.gz
echo 'export PATH="$PATH:/opt/crystal/crystal-0.35.1-1/bin:$PATH"' >> /opt/.profile
source /opt/.profile
# create runnable users and apply limits
for i in {1..150}; do
useradd -M runner$i
@ -362,6 +371,7 @@ If an invalid language is supplied, a typical response will look like the follow
- bash
- c
- cpp
- crystal
- csharp
- deno
- elixir