From 3a9dbf7341f0039ca3531ebb7b0ae4541ca274bf Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Wed, 30 Jul 2025 11:41:35 +0200 Subject: [PATCH] Create temp directories inside a "lazygit" folder rather than top-level in /tmp This is no longer as important now that we fixed the stale, left-over temp dirs caused by daemon mode, but it could still be helpful in case lazygit crashes, or if you have many instances of lazygit running. --- pkg/app/entry_point.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/app/entry_point.go b/pkg/app/entry_point.go index a812154fe..498abc7fe 100644 --- a/pkg/app/entry_point.go +++ b/pkg/app/entry_point.go @@ -124,7 +124,11 @@ func Start(buildInfo *BuildInfo, integrationTest integrationTypes.IntegrationTes os.Exit(0) } - tempDir, err := os.MkdirTemp("", "lazygit-*") + tmpDirBase := filepath.Join(os.TempDir(), "lazygit") + if err := os.MkdirAll(tmpDirBase, 0o700); err != nil { + log.Fatal(err.Error()) + } + tempDir, err := os.MkdirTemp(tmpDirBase, "") if err != nil { log.Fatal(err.Error()) }