Graham Percival <gra...@percival-music.ca> writes:

> On Sat, Jan 14, 2012 at 10:31:43AM -0000, Trevor Daniels wrote:
>> 
>> Graham, you wrote Saturday, January 14, 2012 9:43 AM
>> 
>> >I expect 1 and 2 to work.  If 3 works, we're golden.  If 4
>> >succeeds then something weirder than I think is happening.
>> 
>> Well, 1 works fine, printing out the directory and return code 0
>> but 2 just hangs in the wait(), so nothing is printed.  I have to
>> CTRL-C to recover the terminal.
>
> srsly?!  I really wasn't expect that!
>
> For anybody wanting a quick refresh, this is what hangs:
>     cmd = "dir"
>     proc = subprocess.Popen(cmd, shell=True,
>         stdout=subprocess.PIPE)
>     ret = proc.wait()
>     print "2. return code: ", ret

Having it hang in the wait makes sense, unless the directory is very
small.  You aren't draining the pipe.  Dir is probably blocked on write,
since the pipe is full.  It won't exit unless you read the data from
proc.stdout.  Maybe insert a:

    proc.stdout.readlines()

in there before the wait().

-- 
Michael Welsh Duggan
(m...@md5i.com)


_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to