Timeline for How to emit EOF to a file descriptor (while keeping it open)?
Current License: CC BY-SA 4.0
13 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 25, 2020 at 7:34 | comment | added | JdeBP | Related questions are unix.stackexchange.com/q/323750/5132 , unix.stackexchange.com/q/237334/5132 , unix.stackexchange.com/q/517064/5132 , unix.stackexchange.com/q/377254/5132 , unix.stackexchange.com/q/379347/5132 , and unix.stackexchange.com/q/339674/5132 . | |
| May 25, 2020 at 6:42 | answer | added | Johan Myréen | timeline score: 2 | |
| May 24, 2020 at 23:27 | comment | added | uukgoblin | Also, I'm curious as to why reading after encountering EOF is possible at all. Any background or explanation of why this is so would be greatly appreciated. It seems really weird. | |
| May 24, 2020 at 23:15 | answer | added | Eduardo Trápani | timeline score: 1 | |
| May 24, 2020 at 23:10 | history | edited | uukgoblin | CC BY-SA 4.0 | *really* fix that segfault... :-D |
| May 24, 2020 at 23:01 | history | edited | uukgoblin | CC BY-SA 4.0 | Make the code clearer and fix a segfault if read() returns -1 |
| May 24, 2020 at 22:51 | comment | added | uukgoblin | @EduardoTrápani it's another program I'm writing myself. I'm not sure how to provide an example of the parent program because I'm not sure how to write it. Assume a typical fork scenario with pipes, i.e. as in stackoverflow.com/a/4812963 . So I'm asking: what can parent do to mypipe[1] so that the child sees EOF on mypipe[0], and communication can keep on happening afterwards. As for the situation I'm trying to solve – there isn't any particular, but I am wondering if I can send multiple "logical" files to a process' stdin this way. | |
| May 24, 2020 at 22:46 | history | edited | uukgoblin | CC BY-SA 4.0 | add missing end-bracket |
| May 24, 2020 at 22:43 | comment | added | Eduardo Trápani | What do we know about the parent process? It kind of depends if it's an interactive shell script, a pipe, or another program you compiled. Could you provide an example of the programs, or the execution, maybe the situation you are trying to solve? | |
| May 24, 2020 at 22:39 | comment | added | uukgoblin | @EduardoTrápani I mean how can I cause this to happen in the parent process. As in, what to do in the parent so that the child sees an EOF while still being able to read. I'm guessing creating a PTY could somehow simulate this, but I'm wondering if there are simpler ways (and if there aren't, how to do it via PTY). | |
| May 24, 2020 at 22:37 | history | edited | uukgoblin | CC BY-SA 4.0 | clarify I want the fd to remain open after EOF |
| May 24, 2020 at 22:34 | comment | added | Eduardo Trápani | How can I cause a child process to see some data after seeing EOF? You just did it: you ignore the EOF and keep on reading. Note that that only happens while reading terminal devices, and even in those, you can change the EOF character if you happen to need ^D. | |
| May 24, 2020 at 22:03 | history | asked | uukgoblin | CC BY-SA 4.0 |