fix: use exec env for startup command to fix WaitForCommand detection (#844)
When starting agents with environment variables, the previous approach used 'export VAR=val && claude' which keeps bash as the pane command with the agent as a child process. WaitForCommand polls pane_current_command which returns 'bash', causing a 60-second timeout. Changed to 'exec env VAR=val claude' which replaces the shell with the agent process, making it detectable via pane_current_command. Fixes startup timeout on macOS: 'still running excluded command'
This commit is contained in:
@@ -1264,7 +1264,11 @@ func BuildStartupCommand(envVars map[string]string, rigPath, prompt string) stri
|
||||
|
||||
var cmd string
|
||||
if len(exports) > 0 {
|
||||
cmd = "export " + strings.Join(exports, " ") + " && "
|
||||
// Use 'exec env' instead of 'export ... &&' so the agent process
|
||||
// replaces the shell. This allows WaitForCommand to detect the
|
||||
// running agent via pane_current_command (which shows the direct
|
||||
// process, not child processes).
|
||||
cmd = "exec env " + strings.Join(exports, " ") + " "
|
||||
}
|
||||
|
||||
// Add runtime command
|
||||
@@ -1367,7 +1371,11 @@ func BuildStartupCommandWithAgentOverride(envVars map[string]string, rigPath, pr
|
||||
|
||||
var cmd string
|
||||
if len(exports) > 0 {
|
||||
cmd = "export " + strings.Join(exports, " ") + " && "
|
||||
// Use 'exec env' instead of 'export ... &&' so the agent process
|
||||
// replaces the shell. This allows WaitForCommand to detect the
|
||||
// running agent via pane_current_command (which shows the direct
|
||||
// process, not child processes).
|
||||
cmd = "exec env " + strings.Join(exports, " ") + " "
|
||||
}
|
||||
|
||||
if prompt != "" {
|
||||
|
||||
Reference in New Issue
Block a user