This commit is contained in:
Liang Ding 2020-01-18 17:04:37 +08:00
parent 1287018811
commit 624ef3a152
No known key found for this signature in database
GPG Key ID: 136F30F901A2231D
1 changed files with 3 additions and 1 deletions

View File

@ -68,7 +68,9 @@ func RunHandler(w http.ResponseWriter, r *http.Request, channel map[string]*util
var cmd *exec.Cmd var cmd *exec.Cmd
if conf.Docker { if conf.Docker {
fileName := filepath.Base(filePath) fileName := filepath.Base(filePath)
cmd = exec.Command("sh", "-c \"", "docker run --rm --cpus 0.05 --name "+rid+" -v "+filePath+":/"+fileName+" "+conf.DockerImageGo+" /"+fileName+"\"") cmdStr := "docker run --rm --cpus 0.05 --name " + rid + " -v " + filePath + ":/" + fileName + " " + conf.DockerImageGo + " /" + fileName
logger.Info(cmdStr)
cmd = exec.Command("sh", "-c", cmdStr)
} else { } else {
cmd = exec.Command(filePath) cmd = exec.Command(filePath)
curDir := filepath.Dir(filePath) curDir := filepath.Dir(filePath)