detached eba0b22

feat(app): resolve daemon self-exec path per OS

commit
eba0b225d67a9af0e00f9972799e309ea0eb2c60
author
brice · · 2026-07-16 17:43 UTC
parent
d2d212f
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
4 files · +37 -1
A internal/app/selfexe_darwin.go +9 -0
@@ -0,0 +1,9 @@
1+//go:build darwin
2+
3+package app
4+
5+import "os"
6+
7+func selfExePath() (string, error) {
8+ return os.Executable()
9+}
@@ -0,0 +1,9 @@
1+//go:build darwin
2+
3+package app
4+
5+import "os"
6+
7+func selfExePath() (string, error) {
8+ return os.Executable()
9+}
A internal/app/selfexe_linux.go +7 -0
@@ -0,0 +1,7 @@
1+//go:build linux
2+
3+package app
4+
5+func selfExePath() (string, error) {
6+ return "/proc/self/exe", nil
7+}
@@ -0,0 +1,7 @@
1+//go:build linux
2+
3+package app
4+
5+func selfExePath() (string, error) {
6+ return "/proc/self/exe", nil
7+}
A internal/app/selfexe_linux_test.go +15 -0
@@ -0,0 +1,15 @@
1+//go:build linux
2+
3+package app
4+
5+import "testing"
6+
7+func TestSelfExePath(t *testing.T) {
8+ got, err := selfExePath()
9+ if err != nil {
10+ t.Fatalf("selfExePath: %v", err)
11+ }
12+ if got != "/proc/self/exe" {
13+ t.Fatalf("selfExePath = %q, want %q", got, "/proc/self/exe")
14+ }
15+}
@@ -0,0 +1,15 @@
1+//go:build linux
2+
3+package app
4+
5+import "testing"
6+
7+func TestSelfExePath(t *testing.T) {
8+ got, err := selfExePath()
9+ if err != nil {
10+ t.Fatalf("selfExePath: %v", err)
11+ }
12+ if got != "/proc/self/exe" {
13+ t.Fatalf("selfExePath = %q, want %q", got, "/proc/self/exe")
14+ }
15+}
M internal/app/spawn.go +6 -1
@@ -157,13 +157,18 @@ func realDial(ctx context.Context, dir string) (ports.Transport, error) {
157157 // and never writes to the client's terminal. It logs via slog to the shared
158158 // log file instead.
159159 func realSpawn() error {
160+ exePath, err := selfExePath()
161+ if err != nil {
162+ return fmt.Errorf("resolving executable path: %w", err)
163+ }
164+
160165 devNull, err := os.OpenFile(os.DevNull, os.O_RDWR, 0)
161166 if err != nil {
162167 return fmt.Errorf("opening %s: %w", os.DevNull, err)
163168 }
164169 defer func() { _ = devNull.Close() }()
165170
166- cmd := exec.Command("/proc/self/exe", "--daemon")
171+ cmd := exec.Command(exePath, "--daemon")
167172 cmd.Dir = platform.DirOrHome("")
168173 cmd.Stdin = devNull
169174 cmd.Stdout = devNull
@@ -157,13 +157,18 @@ func realDial(ctx context.Context, dir string) (ports.Transport, error) {
157 // and never writes to the client's terminal. It logs via slog to the shared157 // and never writes to the client's terminal. It logs via slog to the shared
158 // log file instead.158 // log file instead.
159 func realSpawn() error {159 func realSpawn() error {
160+ exePath, err := selfExePath()
161+ if err != nil {
162+ return fmt.Errorf("resolving executable path: %w", err)
163+ }
164+
160 devNull, err := os.OpenFile(os.DevNull, os.O_RDWR, 0)165 devNull, err := os.OpenFile(os.DevNull, os.O_RDWR, 0)
161 if err != nil {166 if err != nil {
162 return fmt.Errorf("opening %s: %w", os.DevNull, err)167 return fmt.Errorf("opening %s: %w", os.DevNull, err)
163 }168 }
164 defer func() { _ = devNull.Close() }()169 defer func() { _ = devNull.Close() }()
165 170
166- cmd := exec.Command("/proc/self/exe", "--daemon")171+ cmd := exec.Command(exePath, "--daemon")
167 cmd.Dir = platform.DirOrHome("")172 cmd.Dir = platform.DirOrHome("")
168 cmd.Stdin = devNull173 cmd.Stdin = devNull
169 cmd.Stdout = devNull174 cmd.Stdout = devNull

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 12

Tags 11

↑↓ moveenter openesc close