mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-05 16:53:29 +08:00
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
This commit is contained in:
@@ -297,7 +297,7 @@
|
|||||||
"type": "command",
|
"type": "command",
|
||||||
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"stop:desktop-notify\" \"scripts/hooks/desktop-notify.js\" \"standard,strict\"",
|
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"stop:desktop-notify\" \"scripts/hooks/desktop-notify.js\" \"standard,strict\"",
|
||||||
"async": true,
|
"async": true,
|
||||||
"timeout": 5
|
"timeout": 10
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Send macOS desktop notification with task summary when Claude responds"
|
"description": "Send macOS desktop notification with task summary when Claude responds"
|
||||||
|
|||||||
@@ -47,7 +47,10 @@ function notifyMacOS(title, body) {
|
|||||||
const safeBody = body.replace(/\\/g, '').replace(/"/g, '\u201C');
|
const safeBody = body.replace(/\\/g, '').replace(/"/g, '\u201C');
|
||||||
const safeTitle = title.replace(/\\/g, '').replace(/"/g, '\u201C');
|
const safeTitle = title.replace(/\\/g, '').replace(/"/g, '\u201C');
|
||||||
const script = `display notification "${safeBody}" with title "${safeTitle}"`;
|
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
|
// TODO: future platform support
|
||||||
|
|||||||
Reference in New Issue
Block a user