瀏覽代碼

fix running go with absolute paths.

Lucas Stadler 11 年之前
父節點
當前提交
ed725ced5d
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      go/qst.go

+ 4 - 1
go/qst.go

@ -29,7 +29,10 @@ qst hello.go - compiles & runs hello.go
29 29
var mappings = map[string]func(string) string{
30 30
	".go": func(name string) string {
31 31
		outpath := strings.TrimSuffix(name, path.Ext(name))
32
		return fmt.Sprintf("go build -o %s %s && ./%s", outpath, name, outpath)
32
		if !path.IsAbs(outpath) {
33
			outpath = fmt.Sprintf("./%s", outpath)
34
		}
35
		return fmt.Sprintf("go build -o %s %s && %s", outpath, name, outpath)
33 36
	},
34 37
	".rb": func(name string) string {
35 38
		return fmt.Sprintf("ruby %s", name)