update code to current
This commit is contained in:
parent
0a563d8b02
commit
0ad7b3f110
6 changed files with 55 additions and 17 deletions
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
|
@ -12,13 +13,18 @@ import (
|
|||
)
|
||||
|
||||
func handleCase(caseName, data string) string {
|
||||
// caseName = strings.ReplaceAll(caseName, "\n", "")
|
||||
caseName = strings.ReplaceAll(caseName, "\n", "")
|
||||
caseName = strings.ReplaceAll(caseName, "\r", "")
|
||||
caseName = strings.ReplaceAll(caseName, ":", "")
|
||||
|
||||
log.Println("Handling case", caseName)
|
||||
switch caseName {
|
||||
case "python", "python3", "py":
|
||||
log.Println(data)
|
||||
runPython(data)
|
||||
default:
|
||||
fmt.Printf("caseName: %q\n", caseName)
|
||||
log.Println(data)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
@ -57,10 +63,8 @@ func runPython(data string) {
|
|||
|
||||
cmd := exec.Command(fname, "./main.py")
|
||||
cmd.Dir = filepath.ToSlash("./workspace/")
|
||||
// set the command's stdout to the pipe writer
|
||||
cmd.Stdout = pyWriter
|
||||
|
||||
// set the command's stderr to the pipe writer
|
||||
cmd.Stdout = pyWriter
|
||||
cmd.Stderr = pyWriter
|
||||
|
||||
// start the command
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue