Suppress stderr output from Linux notification commands to fix WSL errors
- Add 2>/dev/null to notify-send, paplay, and aplay commands - Prevents DBus error logs in WSL environments (Issue #47) - Maintains existing error handling behavior with .catch() 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -56,7 +56,7 @@ async function sendNotification(
|
|||||||
await ctx.$`osascript -e ${"display notification \"" + escapedMessage + "\" with title \"" + escapedTitle + "\""}`
|
await ctx.$`osascript -e ${"display notification \"" + escapedMessage + "\" with title \"" + escapedTitle + "\""}`
|
||||||
break
|
break
|
||||||
case "linux":
|
case "linux":
|
||||||
await ctx.$`notify-send ${escapedTitle} ${escapedMessage}`.catch(() => {})
|
await ctx.$`notify-send ${escapedTitle} ${escapedMessage} 2>/dev/null`.catch(() => {})
|
||||||
break
|
break
|
||||||
case "win32":
|
case "win32":
|
||||||
await ctx.$`powershell -Command ${"[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); [System.Windows.Forms.MessageBox]::Show('" + escapedMessage + "', '" + escapedTitle + "')"}`
|
await ctx.$`powershell -Command ${"[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); [System.Windows.Forms.MessageBox]::Show('" + escapedMessage + "', '" + escapedTitle + "')"}`
|
||||||
@@ -70,8 +70,8 @@ async function playSound(ctx: PluginInput, p: Platform, soundPath: string): Prom
|
|||||||
ctx.$`afplay ${soundPath}`.catch(() => {})
|
ctx.$`afplay ${soundPath}`.catch(() => {})
|
||||||
break
|
break
|
||||||
case "linux":
|
case "linux":
|
||||||
ctx.$`paplay ${soundPath}`.catch(() => {
|
ctx.$`paplay ${soundPath} 2>/dev/null`.catch(() => {
|
||||||
ctx.$`aplay ${soundPath}`.catch(() => {})
|
ctx.$`aplay ${soundPath} 2>/dev/null`.catch(() => {})
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
case "win32":
|
case "win32":
|
||||||
|
|||||||
Reference in New Issue
Block a user