Closed Faulhait closed 2 weeks ago
Redirection is shell syntax and you’ll encounter the same problem with every command.
Add setopt noclobber
to your .zshrc
.
Indeed, this has nothing to do with wl-clipboard, and everything to do with your shell that you invoke wl-clipboard from. wl-copy
doesn't do any of the redirections nor parse or handle the <
syntax, it just reads data from its standard input stream (stdin).
The shell syntax gives you conciseness — you just write < filename.txt
instead of
int fd = open("filename.txt", O_RDONLY);
if (fd < 0) {
// handle the error...
}
dup2(fd, 0);
close(fd);
— but it's much easier to mistype <
as >
than it would be to mistype O_RDONLY
as O_WRONLY | O_TRUNC
.
Issue description
Running
wl-copy > filename.txt
instead of<
deletes the files context and put's the terminal in a waiting state that may be cancelled withctrl + c
.Expected behavior
Running said command should give a shell error. Ideally the command should not require < since the command is always used in the same way (
filename.txt > wl-copy
is not a command) and does not have any paste functions.Metadata
wl-clipboard 2.2.1 zsh 5.9 (x86_64-pc-linux-gnu)