From f6b10481f3d4fefeaab8ac541b7087d7fa308a7a Mon Sep 17 00:00:00 2001 From: Jonghyeok Park Date: Tue, 24 Mar 2026 10:55:15 +0900 Subject: [PATCH] fix: add spawnSync error logging and restore 5s timeout - Check spawnSync result and log warning on failure via stderr - Restore osascript timeout to 5000ms, increase hook deadline to 10s for sufficient headroom --- hooks/hooks.json | 2 +- scripts/hooks/desktop-notify.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hooks/hooks.json b/hooks/hooks.json index d49b401a..d8bdef3c 100644 --- a/hooks/hooks.json +++ b/hooks/hooks.json @@ -297,7 +297,7 @@ "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"stop:desktop-notify\" \"scripts/hooks/desktop-notify.js\" \"standard,strict\"", "async": true, - "timeout": 5 + "timeout": 10 } ], "description": "Send macOS desktop notification with task summary when Claude responds" diff --git a/scripts/hooks/desktop-notify.js b/scripts/hooks/desktop-notify.js index a9bd2540..8d844e03 100644 --- a/scripts/hooks/desktop-notify.js +++ b/scripts/hooks/desktop-notify.js @@ -47,7 +47,10 @@ function notifyMacOS(title, body) { const safeBody = body.replace(/\\/g, '').replace(/"/g, '\u201C'); const safeTitle = title.replace(/\\/g, '').replace(/"/g, '\u201C'); const script = `display notification "${safeBody}" with title "${safeTitle}"`; - spawnSync('osascript', ['-e', script], { stdio: 'ignore', timeout: 3000 }); + const result = spawnSync('osascript', ['-e', script], { stdio: 'ignore', timeout: 5000 }); + if (result.error || result.status !== 0) { + log(`[DesktopNotify] osascript failed: ${result.error ? result.error.message : `exit ${result.status}`}`); + } } // TODO: future platform support