ts support

This commit is contained in:
Brian Seymour 2019-08-08 11:42:30 -05:00
parent 460e393772
commit 8833d4f488
6 changed files with 16 additions and 2 deletions

View File

@ -54,6 +54,7 @@ func Execute(res http.ResponseWriter, req *http.Request) {
"java",
"nasm", "asm",
"javascript", "js", "node",
"typescript", "ts",
"php",
"python", "python2", "python3",
"r",

View File

@ -90,6 +90,9 @@ case "$lang" in
"bash")
bin=bash
;;
"typescript" | "ts")
bin=typescript
;;
*)
echo "invalid language"
exit

6
lxc/executors/typescript Executable file
View File

@ -0,0 +1,6 @@
cd /tmp/$2
mv code.code interim.ts
timeout -s KILL 10 tsc interim.ts
rm interim.ts
mv interim.js code.code
runuser -l runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 nodejs code.code"

View File

@ -39,8 +39,9 @@ sed -i \
apt-get update
apt-get -y install git tzdata nano \
dpkg-dev build-essential python python3 \
ruby nodejs golang php7.2 r-base mono-complete \
ruby nodejs npm golang php7.2 r-base mono-complete \
nasm openjdk-8-jdk ubuntu-make bf
npm install -g typescript
umake swift
ln -s /opt/.local/share/umake/swift/swift-lang/usr/bin/swift /usr/bin/swift
curl https://sh.rustup.rs > rust.sh
@ -106,7 +107,7 @@ If an invalid language is supplied, a typical response will look like the follow
```
#### Supported Languages
Currently python2, python3, c, c++, go, node, ruby, r, c#, nasm, php, java, swift, brainfuck, rust, and bash is supported.
Currently python2, python3, c, c++, go, node, ruby, r, c#, nasm, php, java, swift, brainfuck, rust, bash, and typescript is supported.
#### Principle of Operation
Piston utilizes LXC as the primary mechanism for sandboxing. There is a small API written in Go which takes

1
tests/test.ts Normal file
View File

@ -0,0 +1 @@
console.log('good')

View File

@ -32,3 +32,5 @@ echo 'testing swift'
../lxc/execute swift test.swift
echo 'testing bash'
../lxc/execute bash test.sh
echo 'testing typescript'
../lxc/execute typescript test.ts