fix: 消除进项目时的控制台闪窗
GUI 程序(-H windowsgui)起 console 子进程时若未设 HideWindow, Windows 会为其分配新控制台。refreshGit 一次连跑 3 个 git 进程 = 3 个闪窗(主因),另有 taskkill 和 go vet 两处。 统一 procAttr() 模式(Windows 返回 HideWindow:true,其他平台 nil): - internal/git: 新建 procattr_windows/other.go,run/runOut 挂上 - internal/task: killTree(taskkill)挂上 - internal/app: 新建 procattr_windows/other.go,go vet 挂上
This commit is contained in:
1 parent
a80c0f886a
commit
745ed1f04a
8 files changed
+106
-1
No files matched your search
@@ -104,6 +104,7 @@ func codeFor(x, y byte) string {
|
||||
func run(root string, args ...string) (string, error) {
|
||||
full := append([]string{"-C", root}, args...)
|
||||
cmd := exec.Command("git", full...)
|
||||
cmd.SysProcAttr = procAttr()
|
||||
// 只读查询不要抢 .git/index.lock,免得和外部 git 命令打架。
|
||||
cmd.Env = append(cmd.Environ(), "GIT_OPTIONAL_LOCKS=0")
|
||||
var buf bytes.Buffer
|
||||
@@ -125,6 +126,7 @@ func runOut(root string, args ...string) (string, error) {
|
||||
defer cancel()
|
||||
full := append([]string{"-C", root}, args...)
|
||||
cmd := exec.CommandContext(ctx, "git", full...)
|
||||
cmd.SysProcAttr = procAttr()
|
||||
var buf bytes.Buffer
|
||||
cmd.Stdout = &buf
|
||||
cmd.Stderr = &buf
|
||||
|
||||
Reference in new issue
Block a user