1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-10-16 09:27:37 +03:00
Files
lazygit/pkg/commands/oscommands/os_windows.go
Stefan Haller e056e33da5 Improve CPU usage when flicking through large diffs
The previous commit already fixed the user-visible lag, but there's still a
problem with multiple background git processes consuming resources calculating
diffs that we are never going to show. Improve this by terminating those
processes (by sending them a TERM signal).

Unfortunately this is only possible on Linux and Mac, so Windows users will have
to live with the higher CPU usage. The recommended workaround is to not use
"diff.algorithm = histogram".
2025-08-11 18:07:21 +02:00

31 lines
590 B
Go

package oscommands
import (
"fmt"
"os"
"os/exec"
"path/filepath"
)
func GetPlatform() *Platform {
return &Platform{
OS: "windows",
Shell: "cmd",
ShellArg: "/c",
}
}
func (c *OSCommand) UpdateWindowTitle() error {
path, getWdErr := os.Getwd()
if getWdErr != nil {
return getWdErr
}
argString := fmt.Sprint("title ", filepath.Base(path), " - Lazygit")
return c.Cmd.NewShell(argString, c.UserConfig().OS.ShellFunctionsFile).Run()
}
func TerminateProcessGracefully(cmd *exec.Cmd) error {
// Signals other than SIGKILL are not supported on Windows
return nil
}