ソースを参照

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
	// `go run` it
32
	// `go run` it
33
	res, err := runCode(f)
33
	res, err := runCode(f)
34
	if err != nil {
34
	if err != nil {
35
		return nil, err
35
		return res, err
36
	}
36
	}
37
	// remove the file
37
	// remove the file
38
	os.Remove(f.Name())
38
	os.Remove(f.Name())
68
	//fmt.Println(string(code))
68
	//fmt.Println(string(code))
69
	res, err := Go.Eval(string(code))
69
	res, err := Go.Eval(string(code))
70
	if err != nil {
70
	if err != nil {
71
		http.Error(w, err.Error(), http.StatusNotAcceptable)
71
		http.Error(w, string(res), http.StatusNotAcceptable)
72
		return
72
		return
73
	}
73
	}
74
	w.Write(res)
74
	w.Write(res)