From e346a86bbfaaf2a93126d292b0bcedf1240ce834 Mon Sep 17 00:00:00 2001 From: e1732a364fed <75717694+e1732a364fed@users.noreply.github.com> Date: Sat, 1 Jan 2000 00:00:00 +0000 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E4=BD=BF=E7=94=A8=20syscall.Kill,=20?= =?UTF-8?q?=E5=90=A6=E5=88=99windows=E7=BC=96=E8=AF=91=E4=B8=8D=E9=80=9A?= =?UTF-8?q?=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/verysimple/gui.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/verysimple/gui.go b/cmd/verysimple/gui.go index c1dfb7f..81c80bb 100644 --- a/cmd/verysimple/gui.go +++ b/cmd/verysimple/gui.go @@ -5,6 +5,7 @@ package main // gui界面, 所属计划为 vsc 计划,即versyimple client计划,使用图形界面. 服务端无需gui,所以我们叫client import ( + "os" "syscall" "github.com/e1732a364fed/ui" @@ -298,7 +299,13 @@ func setupUI() { filesM.AppendItem("Open github").OnClicked(openUrlFunc(weblink)) filesM.AppendItem("Check github releases").OnClicked(openUrlFunc(weblink + "releases")) filesM.AppendItem("Quit App").OnClicked(func(mi *ui.MenuItem, w *ui.Window) { - syscall.Kill(syscall.Getpid(), syscall.SIGINT) //退出app + //syscall.Kill(syscall.Getpid(), syscall.SIGINT) //退出app ,syscall.Kill 在windows上不存在 + + if p, err := os.FindProcess(os.Getpid()); err != nil { + + } else { + p.Signal(syscall.SIGINT) + } }) var y = ui.NewMenu("Debug")