This commit is contained in:
cdle
2021-10-01 20:54:54 +08:00
parent fa47e3f942
commit 9e3f160f3e
+4 -1
View File
@@ -60,11 +60,14 @@ func GitPull(filename string) (bool, error) {
}
func CompileCode() error {
cmd := exec.Command("sh", "-c", "cd "+ExecPath+" && go build -o "+pname)
cmd := exec.Command("sh", "-c", "cd "+ExecPath+" && go build -o temp")
_, err := cmd.Output()
if err != nil {
return errors.New("编译失败:" + err.Error() + "。")
}
if err := os.Rename(ExecPath+"/temp", ExecPath+"/"+pname); err != nil {
return errors.New("移动文件:" + err.Error() + "。")
}
sillyGirl.Set("compiled_at", time.Now().Format("2006-01-02 15:04:05"))
return nil
}