增加 javascript 支持

This commit is contained in:
virusdefender 2021-09-28 15:43:38 +08:00
parent 99b145e37c
commit 934edfc1bc
1 changed files with 32 additions and 4 deletions

View File

@ -189,13 +189,40 @@ _go_lang_config = {
"max_real_time": 5000,
"max_memory": 1024 * 1024 * 1024,
"compile_command": "/usr/bin/go build -o {exe_path} {src_path}",
"env": ["GOCACHE=/tmp", "GOPATH=/tmp"]
"env": ["GOCACHE=/tmp", "GOPATH=/tmp", "GOMAXPROCS=1"] + default_env
},
"run": {
"command": "{exe_path}",
"seccomp_rule": "",
"seccomp_rule": "golang",
# 降低内存占用
"env": ["GODEBUG=madvdontneed=1"] + default_env,
"env": ["GODEBUG=madvdontneed=1", "GOMAXPROCS=1"] + default_env,
"memory_limit_check_only": 1
}
}
_node_lang_config = {
"template": """//PREPEND BEGIN
//PREPEND END
//TEMPLATE BEGIN
//TEMPLATE END
//APPEND BEGIN
//APPEND END""",
"compile": {
"src_name": "main.js",
"exe_name": "main.js",
"max_cpu_time": 3000,
"max_real_time": 5000,
"max_memory": 1024 * 1024 * 1024,
"compile_command": "/usr/bin/node --check {src_path}",
"env": default_env
},
"run": {
"command": "/usr/bin/node {exe_path}",
"seccomp_rule": "node",
# 降低内存占用
"env": default_env,
"memory_limit_check_only": 1
}
}
@ -208,5 +235,6 @@ languages = [
{"config": _java_lang_config, "name": "Java", "description": "OpenJDK 11", "content_type": "text/x-java"},
{"config": _py2_lang_config, "name": "Python2", "description": "Python 2.7", "content_type": "text/x-python"},
{"config": _py3_lang_config, "name": "Python3", "description": "Python 3.6", "content_type": "text/x-python"},
{"config": _go_lang_config, "name": "Golang", "description": "Golang 1.15", "content_type": "text/x-go"},
{"config": _go_lang_config, "name": "Golang", "description": "Golang 1.17", "content_type": "text/x-go"},
{"config": _node_lang_config, "name": "JavaScript", "description": "Node 14", "content_type": "text/javascript"},
]