Skip navigation

I R HATEZ UNIX!!!!

Say you want to start a subprocess and feed it some data. That should look like this:

  p = start("name-of-thing-to-start")

  while not p.poll() :
    p.stdin.write( stuff_you_get() )

Alas, this is wrong, wrong, wrong. Say the stuff we get is exit and the thing we start is the shell. The shell receives exit and starts dying — but not fast enough to trip the poll() in our while loop, so then we write some stuff and oops, we get SIGPIPE.

Advertisements

Post a Comment

You must be logged in to post a comment.
%d bloggers like this: