mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-02 15:23:19 +08:00
fix(cli): resolve process hang after CLI execution
Root cause: HTTP Keep-Alive connections kept event loop alive, preventing process.exit() from executing even after CLI_EXECUTION_COMPLETED event was sent. Fix: Add `agent: false` and `Connection: close` header to HTTP requests in notifyDashboard() and broadcastStreamEvent() functions. - agent: false - Creates new Agent per request instead of global Keep-Alive Agent - Connection: close - Tells server to close connection after response Fixes issue where `ccw cli --tool gemini` would complete execution but Bash command would hang indefinitely.
This commit is contained in:
@@ -51,9 +51,11 @@ function notifyDashboard(data: Record<string, unknown>): void {
|
||||
path: '/api/hook',
|
||||
method: 'POST',
|
||||
timeout: 2000, // 2 second timeout to prevent hanging
|
||||
agent: false, // Disable Keep-Alive to allow process exit
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Content-Length': Buffer.byteLength(payload)
|
||||
'Content-Length': Buffer.byteLength(payload),
|
||||
'Connection': 'close' // Ensure connection closes after response
|
||||
}
|
||||
});
|
||||
|
||||
@@ -93,9 +95,11 @@ function broadcastStreamEvent(eventType: string, payload: Record<string, unknown
|
||||
path: '/api/hook',
|
||||
method: 'POST',
|
||||
timeout: 1000, // Short timeout for streaming
|
||||
agent: false, // Disable Keep-Alive to allow process exit
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Content-Length': Buffer.byteLength(data)
|
||||
'Content-Length': Buffer.byteLength(data),
|
||||
'Connection': 'close' // Ensure connection closes after response
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user