mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-01 14:43:28 +08:00
fix(hooks): preserve WSL desktop notify success path
This commit is contained in:
@@ -71,7 +71,12 @@ function notifyWindows(pwshPath, title, body) {
|
||||
const command = `Import-Module BurntToast; New-BurntToastNotification -Text '${safeTitle}', '${safeBody}'`;
|
||||
const result = spawnSync(pwshPath, ['-Command', command],
|
||||
{ stdio: ['ignore', 'pipe', 'pipe'], timeout: 5000 });
|
||||
return result.status === 0;
|
||||
if (result.error || result.status !== 0) {
|
||||
const stderr = typeof result.stderr?.toString === 'function' ? result.stderr.toString().trim() : '';
|
||||
log(`[DesktopNotify] BurntToast failed (exit ${result.status}): ${result.error ? result.error.message : stderr}`);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,20 +113,6 @@ function notifyMacOS(title, body) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a Windows Toast notification via PowerShell BurntToast.
|
||||
* Used when running under WSL to show notification on Windows desktop.
|
||||
*/
|
||||
function notifyWindows(pwshPath, title, body) {
|
||||
const safeBody = body.replace(/'/g, "''");
|
||||
const safeTitle = title.replace(/'/g, "''");
|
||||
const command = `Import-Module BurntToast; New-BurntToastNotification -Text '${safeTitle}', '${safeBody}'`;
|
||||
const result = spawnSync(pwshPath, ['-Command', command], { stdio: ['ignore', 'pipe', 'pipe'], timeout: 5000 });
|
||||
if (result.error || result.status !== 0) {
|
||||
log(`[DesktopNotify] BurntToast failed (exit ${result.status}): ${result.error ? result.error.message : result.stderr?.toString()}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fast-path entry point for run-with-flags.js (avoids extra process spawn).
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user