From 4cb999c5309b278674ed3ab6d7baf2a977ab068c Mon Sep 17 00:00:00 2001 From: Brian Seymour Date: Mon, 8 Jun 2020 22:19:06 -0500 Subject: [PATCH] add elisp aliases, add emacs version detection, test elixir using new executor --- api/main.go | 10 ++++++++-- lxc/executors/elixir | 7 ++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/api/main.go b/api/main.go index aa41044..8e475fc 100644 --- a/api/main.go +++ b/api/main.go @@ -71,7 +71,7 @@ func Execute(res http.ResponseWriter, req *http.Request) { "cpp", "c++", "csharp", "cs", "c#", "elixir", "exs", - "elisp", "el", + "emacs", "elisp", "el", "go", "java", "julia", "jl", @@ -142,7 +142,9 @@ func launch(request Inbound, res http.ResponseWriter) { execlang = "cpp" case "cs", "c#": execlang = "csharp" - case "elixir", "exs": + case "el", "elisp": + execlang = "emacs" + case "exs": execlang = "elixir" case "asm": execlang = "nasm" @@ -236,5 +238,9 @@ func GetVersion(s string) (string, string) { return "java", regexp.MustCompile("([0-9]+)").FindString(lines[2]) } + if lines[1] == "emacs" { + return "emacs", regexp.MustCompile("([0-9]+\\.[0-9]+)").FindString(lines[2]) + } + return lines[1], regexp.MustCompile("([0-9]+\\.[0-9]+\\.[0-9]+)").FindString(s) } diff --git a/lxc/executors/elixir b/lxc/executors/elixir index bee79a4..49f9679 100755 --- a/lxc/executors/elixir +++ b/lxc/executors/elixir @@ -1,2 +1,7 @@ cd /tmp/$2 -runuser runner$1 -c "cd /tmp/$2 ; cat args.args ; xargs -d '\n' timeout -s KILL 3 elixir code.code" + +if [[ -z $(grep '[^[:space:]]' args.args) ]]; then + runuser runner$1 -c "cd /tmp/$2 ; timeout -s KILL 3 elixir code.code" +else + runuser runner$1 -c "cd /tmp/$2 ; cat args.args ; xargs -d '\n' timeout -s KILL 3 elixir code.code" +fi