Posts: 4,646
Threads: 1,493
Joined: Sep 2016
Jan-05-2023, 07:18 PM
(This post was last modified: Jan-06-2023, 01:17 PM by Yoriz.
Edit Reason: Title
)
which exception do you get when you os.write() to a pipe that has nothing reading it?
i thought it would be
BrokenPipeError so i tried some tests but i'm not getting anything.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,646
Threads: 1,493
Joined: Sep 2016
i tried a bunch of things in interactive Python and got a variety of responses but none of them gave an exception. some would hang, with one even blocking Ctrl-C (e.g. ^C would have no effect). when i could check it, the return value was inconsistent. what search string should find this?
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,646
Threads: 1,493
Joined: Sep 2016
it is OK to write into the write end of a pipe even when nothing is reading the other end. this is an essential behavior because after a read completes, there is a period of time until the next read operation is performed. you wouldn't want to have writes just periodically fail because it just happened at the wrong time. to do that, pipes would need to do event synchronization and that's just not done, especially when the writer and reader are ordinary programs that get piped together on a POSIX shell pipeline (these processes are not doing things like select() or poll(). with this i need to go back and re-think what i was trying to do and why.
i'm thinking i need to go back and do some stuff in C, again, just to get my brain thinking about the system.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,646
Threads: 1,493
Joined: Sep 2016
SIGPIPE happens when the read end is closed, not when there is just no read() call that is active (the file descriptor, when closed, is no longer there). i was originally confusing this distinction when i was doing the initial logic design of my current project being done in Python. this revealed to me that my memory about the system semantics was fuzzy, hence the idea to do some things in C, again, particularly, using Python to prototype some of those designs.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.