Skip to content

Commit 56027d3

Browse files
author
Michael Collard
committed
Fix: Suppress clipboard command error messages on Linux
Use OS-specific command strings with proper error redirection: - Linux/Wayland: Append '2>/dev/null' to wl-copy/wl-paste and X11 fallbacks - Windows: Use '2>nul' for PowerShell error suppression - macOS: pbcopy/pbpaste don't need redirection (commands exist) This prevents misleading 'wl-paste: not found' and similar errors from appearing to users on systems without Wayland tools, while maintaining full fallback logic for alternative clipboard utilities.
1 parent 181f792 commit 56027d3

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

src/nvim/brutal.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ void brutal_copy_to_system_clipboard( const char *text )
163163
const char *cmds[] = { "pbcopy", NULL };
164164
#else
165165
const char *cmds[] = {
166-
"wl-copy",
167-
"xclip -selection clipboard -i",
168-
"xsel --clipboard --input",
169-
"clip.exe", // WSL fallback
166+
"wl-copy 2>/dev/null",
167+
"xclip -selection clipboard -i 2>/dev/null",
168+
"xsel --clipboard --input 2>/dev/null",
169+
"clip.exe 2>/dev/null",
170170
NULL
171171
};
172172
#endif
@@ -193,15 +193,15 @@ char *brutal_paste_from_system_clipboard( void )
193193
return NULL; // Let provider path handle it
194194
}
195195
#if defined(_WIN32)
196-
const char *cmds[] = { "powershell.exe -command Get-Clipboard", NULL };
196+
const char *cmds[] = { "powershell.exe -command Get-Clipboard 2>nul", NULL };
197197
#elif defined(__APPLE__)
198198
const char *cmds[] = { "pbpaste", NULL };
199199
#else
200200
const char *cmds[] = {
201-
"wl-paste",
202-
"xclip -selection clipboard -o",
203-
"xsel --clipboard --output",
204-
"powershell.exe -command Get-Clipboard", // WSL fallback
201+
"wl-paste 2>/dev/null",
202+
"xclip -selection clipboard -o 2>/dev/null",
203+
"xsel --clipboard --output 2>/dev/null",
204+
"powershell.exe -command Get-Clipboard 2>/dev/null",
205205
NULL
206206
};
207207
#endif

0 commit comments

Comments
 (0)