diff --git a/Dockerfile b/Dockerfile index 83e0842..419591f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,9 +15,7 @@ ENV LANG C.UTF-8 RUN apt update -y # install gcc g++ -RUN apt install -y \ - g++ \ - gcc +RUN apt install -y gcc g++ # install python3.8 RUN apt install -y software-properties-common && \ diff --git a/plugins/js/package.json b/plugins/js/package.json new file mode 100644 index 0000000..c707344 --- /dev/null +++ b/plugins/js/package.json @@ -0,0 +1,16 @@ +{ + "name": "js", + "version": "1.0.0", + "description": "```bash cd plugins/js ./validate.js success.js ./validate.js failure.js ```", + "main": "failure.js", + "dependencies": { + "esprima": "^4.0.1" + }, + "devDependencies": {}, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC" +} diff --git a/plugins/js/validate.js b/plugins/js/validate.js index 132206e..5daa8dd 100755 --- a/plugins/js/validate.js +++ b/plugins/js/validate.js @@ -1,4 +1,4 @@ -#!/usr/local/bin/node +#!/usr/bin/node const fs = require('fs'); const esprima = require('esprima'); diff --git a/src/judger.rs b/src/judger.rs index ebd6769..29f9c30 100644 --- a/src/judger.rs +++ b/src/judger.rs @@ -39,7 +39,7 @@ pub async fn judger( let cmd = match Language::from_i32(request.language) { Some(Language::C) => "./a.out", Some(Language::Cpp) => "./a.out", - Some(Language::Python) => "/usr/bin/python3 main.py", + Some(Language::Python) => "/usr/bin/python3.8 main.py", Some(Language::Rust) => "./a.out", Some(Language::Node) => "node main.js", Some(Language::TypeScript) => "node main.js", @@ -119,9 +119,9 @@ pub async fn compile( let cmd = match Language::from_i32(request.language) { Some(Language::C) => "/usr/bin/gcc main.c -o a.out -Wall -O2 -std=c99 --static", Some(Language::Cpp) => "/usr/bin/g++ main.cpp -O2 -Wall --static -o a.out --std=gnu++17", - Some(Language::Python) => "/usr/bin/python3 -m compileall main.py", - Some(Language::Rust) => "/usr/bin/rustc main.rs -o a.out -C opt-level=2", - Some(Language::Node) => "validate.js main.js", + Some(Language::Python) => "/usr/bin/python3.8 -m compileall main.py", + Some(Language::Rust) => "/root/.cargo/bin/rustc main.rs -o a.out -C opt-level=2", + Some(Language::Node) => "/usr/bin/node /plugins/js/validate.js main.js", Some(Language::TypeScript) => "/usr/bin/tsc main.ts", Some(Language::Go) => "/usr/bin/go build -ldflags \"-s -w\" main.go", None => return Err(Error::LanguageNotFound(request.language)),