fix: 后台下载改用 Start-Process,避免子进程继承管道句柄阻塞 hook
start /b 派生的进程会继承 Claude 传给 hook 的 stdout 管道句柄,curl 攥着不放 导致 Claude 读不到 EOF、直到下载完才放行(hook 被卡住)。改用 powershell Start-Process 启动下载,它默认不继承父进程句柄,hook 立即返回、下载后台继续。
This commit is contained in:
+6
-1
@@ -29,7 +29,12 @@ if exist "%LOCK%" call :reclaim
|
||||
|
||||
rem atomic lock: only the first hook spawns the worker; others fall through and just
|
||||
rem report progress -> no duplicate downloads even when hooks fire concurrently.
|
||||
mkdir "%LOCK%" 2>nul && start "" /b "%~f0" __download <nul >nul 2>&1
|
||||
rem
|
||||
rem must use Start-Process (not `start /b`): a child started by cmd inherits the
|
||||
rem hook's stdout pipe handle, so Claude won't see EOF until the download ends ->
|
||||
rem the hook would block. Start-Process spawns WITHOUT inheriting handles, so the
|
||||
rem hook returns immediately while curl keeps running detached.
|
||||
mkdir "%LOCK%" 2>nul && powershell -nop -w hidden -c "Start-Process -WindowStyle Hidden -FilePath '%~f0' -ArgumentList '__download'" >nul 2>&1
|
||||
|
||||
rem downloaded size so far (from the .partial file), shown as X.X MB
|
||||
set "DLBYTES=0"
|
||||
|
||||
Reference in New Issue
Block a user