fix: inherit environment in daemon subprocess calls (#876)
The daemon's exec.Command calls were not explicitly setting cmd.Env, causing subprocesses to fail when the daemon process doesn't have the expected PATH environment variable. This manifests as: Warning: failed to fetch deacon inbox: exec: "gt": executable file not found in $PATH When the daemon is started by mechanisms with minimal environments (launchd, systemd, or shells without full PATH), executables like gt, bd, git, and sqlite3 couldn't be found. The fix adds cmd.Env = os.Environ() to all 15 subprocess calls across three files, ensuring they inherit the daemon's full environment. Affected commands: - gt mail inbox/delete/send (lifecycle requests, notifications) - bd sync/show/list/activity (beads operations) - git fetch/pull (workspace pre-sync) - sqlite3 (convoy completion queries) Fixes #875 Co-authored-by: Jackson Cantrell <cantrelljax@gmail.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1101,6 +1101,7 @@ Manual intervention may be required.`,
|
||||
|
||||
cmd := exec.Command("gt", "mail", "send", witnessAddr, "-s", subject, "-m", body) //nolint:gosec // G204: args are constructed internally
|
||||
cmd.Dir = d.config.TownRoot
|
||||
cmd.Env = os.Environ() // Inherit PATH to find gt executable
|
||||
if err := cmd.Run(); err != nil {
|
||||
d.logger.Printf("Warning: failed to notify witness of crashed polecat: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user