Add new argument to pass a file directly.#256
Add new argument to pass a file directly.#256bergmannf wants to merge 1 commit intobugaevc:masterfrom
Conversation
369e351 to
28f9f39
Compare
Instead of always using stdin and creating a tempfile, this argument will use a file passed by the user instead. This can be useful for integrating into other programs, that don't want to start a subshell to use pipes.
28f9f39 to
3896a6b
Compare
|
Hi, while we could do something like this, I'm not seeing why it's needed for your use case at all:
You shouldn't need a subshell or a pipe just to pass a file as a standard input stream to a subprocess. Just... pass it. if you're doing raw Unix, it goes something like this: pid = fork();
if (pid == 0) {
// child
dup2(input_file_fd, STDIN_FILENO);
close(input_file_fd);
exec("the-child");
} else {
close(input_file_fd);
...
}If you're using something higher-level, there should normally be a way to configure what gets passed as standard I/O streams. For instance in Python
I readily admit that I'm not very familiar with the Emacs API, but it sounds like So one way for you to integrate |
|
Wow - thanks for the really in-depth research you did for this. So I went digging to see why it hangs, and I think the problem is that emacs actually passes the
(The emacs output contains a lot more stuff obviously, but that is the interesting one). So checking what this fd is, it shows up as a pipe: And for I did compile a version of I guess the better way is to just use an async process in emacs so the long-living fork of wl-copy won't block emacs. |
Instead of always using stdin and creating a tempfile, this argument will allow using a file passed by the user instead.
This can be useful for integrating into other programs, that don't want to start a subshell to use pipes: e.g. in my case I want to use https://github.com/jkitchin/ox-clip and replace the current
xclipbywl-copybut that needswl-copyto accept a file argument.