Skip to content

Commit b3844fe

Browse files
appleboyCopilot
andauthored
Update util/api_key_helper_unix.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 3b2807e commit b3844fe

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

util/api_key_helper_unix.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ func GetAPIKeyFromHelper(ctx context.Context, helperCmd string) (string, error)
7171

7272
case <-ctx.Done():
7373
// Timeout or cancellation: terminate the process group gracefully, then forcefully
74+
if cmd.Process == nil {
75+
// Process handle not initialized; wait for cleanup and report timeout
76+
<-done
77+
return "", fmt.Errorf("api_key_helper command timed out after %v", HelperTimeout)
78+
}
7479
pgid := cmd.Process.Pid
7580

7681
// First attempt: send SIGTERM to the entire process group for graceful shutdown

0 commit comments

Comments
 (0)