浏览代码

Abort if editor does not return 0

This allows the user to abort the install by telling the editor to exit
with a non zero status. e.g. `:cq` in vim. This should also catch errors
if the editor does actually fail or if the configured editor does not
exist.
morganamilo 7 年之前
父节点
当前提交
695927c4cd
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      install.go

+ 4 - 1
install.go

@@ -307,7 +307,10 @@ func askEditPkgBuilds(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg) error {
 		if !continueTask(str, "yY") {
 			editcmd := exec.Command(editor(), dir+"PKGBUILD")
 			editcmd.Stdin, editcmd.Stdout, editcmd.Stderr = os.Stdin, os.Stdout, os.Stderr
-			editcmd.Run()
+			err := editcmd.Run()
+			if err != nil {
+				return fmt.Errorf("Editor did not exit successfully, Abotring: %s", err)
+			}
 		}
 	}