detached 577c404

fix(cef): move MaybeExitSubprocess to main() before Cobra

CEF re-launches the binary with --type=renderer for subprocesses.
Previously MaybeExitSubprocess ran inside NewEngine, after Cobra had
already parsed and stripped args. Now runs at top of main() when
DUMBER_ENGINE=cef, before any arg processing. Also adopts NewClient
returning Client directly (no more clientAdapter).
commit
577c40419a15aeff1455cf8d1c5c58aec9f31831
author
brice · · 2026-03-19 19:25 UTC
committer
brice · · 2026-03-28 04:36 UTC
parent
2ccf5f3
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +11 -1
M cmd/dumber/main.go +9 -0
@@ -34,6 +34,7 @@ import (
3434 "github.com/bnema/dumber/internal/ui/adapter"
3535 "github.com/bnema/dumber/internal/ui/component"
3636 "github.com/bnema/dumber/internal/ui/theme"
37+ cef "github.com/bnema/purego-cef/cef"
3738 "github.com/bnema/puregotk/v4/gtk"
3839 "github.com/rs/zerolog"
3940 )
@@ -54,6 +55,14 @@ var restoreSessionID string
5455 func main() {
5556 enableCrashForensics()
5657
58+ // CEF subprocess handling: when CEF re-launches the binary with
59+ // --type=renderer/gpu/etc, we must call ExecuteProcess before anything
60+ // else (Cobra, config, arg stripping). This only runs when the engine
61+ // is set to "cef" and exits immediately for subprocess invocations.
62+ if os.Getenv("DUMBER_ENGINE") == "cef" {
63+ cef.MaybeExitSubprocess()
64+ }
65+
5766 // Run GUI mode for browse command
5867 if len(os.Args) > 1 && os.Args[1] == "browse" {
5968 if len(os.Args) > 2 {
@@ -34,6 +34,7 @@ import (
34 "github.com/bnema/dumber/internal/ui/adapter"34 "github.com/bnema/dumber/internal/ui/adapter"
35 "github.com/bnema/dumber/internal/ui/component"35 "github.com/bnema/dumber/internal/ui/component"
36 "github.com/bnema/dumber/internal/ui/theme"36 "github.com/bnema/dumber/internal/ui/theme"
37+ cef "github.com/bnema/purego-cef/cef"
37 "github.com/bnema/puregotk/v4/gtk"38 "github.com/bnema/puregotk/v4/gtk"
38 "github.com/rs/zerolog"39 "github.com/rs/zerolog"
39 )40 )
@@ -54,6 +55,14 @@ var restoreSessionID string
54 func main() {55 func main() {
55 enableCrashForensics()56 enableCrashForensics()
56 57
58+ // CEF subprocess handling: when CEF re-launches the binary with
59+ // --type=renderer/gpu/etc, we must call ExecuteProcess before anything
60+ // else (Cobra, config, arg stripping). This only runs when the engine
61+ // is set to "cef" and exits immediately for subprocess invocations.
62+ if os.Getenv("DUMBER_ENGINE") == "cef" {
63+ cef.MaybeExitSubprocess()
64+ }
65+
57 // Run GUI mode for browse command66 // Run GUI mode for browse command
58 if len(os.Args) > 1 && os.Args[1] == "browse" {67 if len(os.Args) > 1 && os.Args[1] == "browse" {
59 if len(os.Args) > 2 {68 if len(os.Args) > 2 {
M internal/infrastructure/cef/engine_init.go +2 -1
@@ -22,7 +22,8 @@ func NewEngine(ctx context.Context, cfg config.CEFEngineConfig, logger zerolog.L
2222 settings.LogSeverity = cfg.LogSeverity
2323 }
2424
25- purecef.MaybeExitSubprocess()
25+ // NOTE: MaybeExitSubprocess is called in main() before Cobra, so that
26+ // CEF subprocess args (--type=renderer) are handled before arg stripping.
2627
2728 if err := purecef.Init(settings); err != nil {
2829 return nil, fmt.Errorf("cef.Init: %w", err)
@@ -22,7 +22,8 @@ func NewEngine(ctx context.Context, cfg config.CEFEngineConfig, logger zerolog.L
22 settings.LogSeverity = cfg.LogSeverity22 settings.LogSeverity = cfg.LogSeverity
23 }23 }
24 24
25- purecef.MaybeExitSubprocess()25+ // NOTE: MaybeExitSubprocess is called in main() before Cobra, so that
26+ // CEF subprocess args (--type=renderer) are handled before arg stripping.
26 27
27 if err := purecef.Init(settings); err != nil {28 if err := purecef.Init(settings); err != nil {
28 return nil, fmt.Errorf("cef.Init: %w", err)29 return nil, fmt.Errorf("cef.Init: %w", err)

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 8

Tags 42

↑↓ moveenter openesc close