[pony-build] Phone call tonight - cancel?

C. Titus Brown ctb at msu.edu
Sat Mar 20 11:11:29 PDT 2010


On Mon, Mar 08, 2010 at 09:42:50PM -0400, Max Laite wrote:
> Does not matter to me either way with the phone call. The following is most
> likely what I would say plus or minus a few embellishments.
> 
> "What I have been working on....."
> 
> Been messing around with the timeout stuff, have to test the code now.
> See my subprocess branch for the changes I made to _run_command.

Hi Max,

good stuff, and necessary!

I see a couple of potential or actual problems, though ;).

The first is that by using 'poll' you're going to run into this problem:

  http://ivory.idyll.org/blog/feb-07/problems-with-subprocess

where the stdout buffer is filling up and causing the actual child
process to block on output & hang.  Let me know if you want some more
detail on this.

By far the cleanest way to deal with this is to use 'communicate', but
that doesn't return until the child ends.  The next best way is to
use poll in combination with non-blocking pipe reads and essentially
busy-wait, e.g.

   while 1:
      if p.poll() is not None: # ... done
      p.stdout.read()
      p.stderr.read()

etc.

but that's ugly and I've never gotten it to work well myself.

Have you thought about using the signal module and setting a signal.alarm?
I can't tell if that will work on Windows -- I think it will -- and if
it does, well, then you're good.

See http://github.com/ctb/zounds/blob/master/zounds-worker for an example
that works on UNIX.

--

The second big problem for me is that the Windows code gives me the
heeby jeebies -- not because it doesn't work (I assume it does!) but
because there aren't any automated tests for it that would let me test it out
for myself on a regular basis on Windows.  So, please please please put
together some automated tests!

--

cheers,
--titus



More information about the pony-build mailing list