ソースを参照

return the command output on error as well

Lucas Stadler 11 年 前
コミット
bc68276bba
共有1 個のファイルを変更した2 個の追加2 個の削除を含む
  1. 2 2
      go/linguaevalia.go

+ 2 - 2
go/linguaevalia.go

@ -32,7 +32,7 @@ func (g LanguageGo) Eval(code string) ([]byte, error) {
32 32
	// `go run` it
33 33
	res, err := runCode(f)
34 34
	if err != nil {
35
		return nil, err
35
		return res, err
36 36
	}
37 37
	// remove the file
38 38
	os.Remove(f.Name())
@ -68,7 +68,7 @@ func runCodeHandler(w http.ResponseWriter, r *http.Request) {
68 68
	//fmt.Println(string(code))
69 69
	res, err := Go.Eval(string(code))
70 70
	if err != nil {
71
		http.Error(w, err.Error(), http.StatusNotAcceptable)
71
		http.Error(w, string(res), http.StatusNotAcceptable)
72 72
		return
73 73
	}
74 74
	w.Write(res)