fix(cef): propagate selected runtime to helpers
- commit
- 879e5fe524a16c3444cb46f7ada1bf4600c7ec26
- author
- brice · · 2026-07-14 07:38 UTC
- committer
- brice · · 2026-07-14 09:35 UTC
- parent
- eee76d7
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +19 -3
M internal/infrastructure/cef/engine_init.go +19 -3
| @@ -147,6 +147,24 @@ func resolvedStateRoot(defaultStateRoot string, opts port.EngineOptions) string | |||
| 147 | 147 | return defaultStateRoot | |
| 148 | 148 | } | |
| 149 | 149 | ||
| 150 | + | // configureCEFSubprocessRuntime chooses the CEF runtime used by both the | |
| 151 | + | // browser and CEF helper processes. CEF re-execs this binary for helpers before | |
| 152 | + | // Dumber can load configuration, so the selected configured runtime must be in | |
| 153 | + | // its inherited environment before InitWithApp launches any child. A caller's | |
| 154 | + | // explicit CEF_DIR remains the override for both process types. | |
| 155 | + | func configureCEFSubprocessRuntime(configured string) string { | |
| 156 | + | if explicit := os.Getenv("CEF_DIR"); explicit != "" { | |
| 157 | + | return explicit | |
| 158 | + | } | |
| 159 | + | if configured == "" { | |
| 160 | + | return "" | |
| 161 | + | } | |
| 162 | + | if err := os.Setenv("CEF_DIR", configured); err != nil { | |
| 163 | + | return configured | |
| 164 | + | } | |
| 165 | + | return configured | |
| 166 | + | } | |
| 167 | + | ||
| 150 | 168 | // prepareCEFSettings builds purecef.Settings from the engine config. | |
| 151 | 169 | func prepareCEFSettings( | |
| 152 | 170 | opts port.EngineOptions, | |
| @@ -170,9 +188,7 @@ func prepareCEFSettings( | |||
| 170 | 188 | settings.MultiThreadedMessageLoop = true | |
| 171 | 189 | settings.ExternalMessagePump = false | |
| 172 | 190 | settings.RootCachePath = resolvedStateRoot(paths.StateRoot, opts) | |
| 173 | - | if cfg.CEFDir != "" { | |
| 174 | - | settings.CEFDir = cfg.CEFDir | |
| 175 | - | } | |
| 191 | + | settings.CEFDir = configureCEFSubprocessRuntime(cfg.CEFDir) | |
| 176 | 192 | if runtimeLogFile, err := prepareCEFLogFile(paths.LogFile, cfg.LogFile); err != nil { | |
| 177 | 193 | logger.Warn().Err(err).Msg("cef: failed to prepare runtime log file") | |
| 178 | 194 | } else { | |
| @@ -147,6 +147,24 @@ func resolvedStateRoot(defaultStateRoot string, opts port.EngineOptions) string | |||||
| 147 | return defaultStateRoot | 147 | return defaultStateRoot | ||
| 148 | } | 148 | } | ||
| 149 | 149 | ||||
| 150 | + | // configureCEFSubprocessRuntime chooses the CEF runtime used by both the | |||
| 151 | + | // browser and CEF helper processes. CEF re-execs this binary for helpers before | |||
| 152 | + | // Dumber can load configuration, so the selected configured runtime must be in | |||
| 153 | + | // its inherited environment before InitWithApp launches any child. A caller's | |||
| 154 | + | // explicit CEF_DIR remains the override for both process types. | |||
| 155 | + | func configureCEFSubprocessRuntime(configured string) string { | |||
| 156 | + | if explicit := os.Getenv("CEF_DIR"); explicit != "" { | |||
| 157 | + | return explicit | |||
| 158 | + | } | |||
| 159 | + | if configured == "" { | |||
| 160 | + | return "" | |||
| 161 | + | } | |||
| 162 | + | if err := os.Setenv("CEF_DIR", configured); err != nil { | |||
| 163 | + | return configured | |||
| 164 | + | } | |||
| 165 | + | return configured | |||
| 166 | + | } | |||
| 167 | + | ||||
| 150 | // prepareCEFSettings builds purecef.Settings from the engine config. | 168 | // prepareCEFSettings builds purecef.Settings from the engine config. | ||
| 151 | func prepareCEFSettings( | 169 | func prepareCEFSettings( | ||
| 152 | opts port.EngineOptions, | 170 | opts port.EngineOptions, | ||
| @@ -170,9 +188,7 @@ func prepareCEFSettings( | |||||
| 170 | settings.MultiThreadedMessageLoop = true | 188 | settings.MultiThreadedMessageLoop = true | ||
| 171 | settings.ExternalMessagePump = false | 189 | settings.ExternalMessagePump = false | ||
| 172 | settings.RootCachePath = resolvedStateRoot(paths.StateRoot, opts) | 190 | settings.RootCachePath = resolvedStateRoot(paths.StateRoot, opts) | ||
| 173 | - | if cfg.CEFDir != "" { | 191 | + | settings.CEFDir = configureCEFSubprocessRuntime(cfg.CEFDir) |
| 174 | - | settings.CEFDir = cfg.CEFDir | |||
| 175 | - | } | |||
| 176 | if runtimeLogFile, err := prepareCEFLogFile(paths.LogFile, cfg.LogFile); err != nil { | 192 | if runtimeLogFile, err := prepareCEFLogFile(paths.LogFile, cfg.LogFile); err != nil { | ||
| 177 | logger.Warn().Err(err).Msg("cef: failed to prepare runtime log file") | 193 | logger.Warn().Err(err).Msg("cef: failed to prepare runtime log file") | ||
| 178 | } else { | 194 | } else { | ||