[Haskell-cafe] struggling with blocking shell cmd when using System.Process

Brandon Allbery allbery.b at gmail.com
Tue Mar 20 23:15:20 CET 2012


On Tue, Mar 20, 2012 at 17:51, Rouan van Dalen <rvdalen at yahoo.co.uk> wrote:

> If I try to su the runShell function with the following command, it simply
> blocks forever:
>
>     git --no-pager blame <your git file here>
>
> but if I do:
>
>     git status
>
> The runShell function works as expected.  Can someone shed some light on
> why the 'git blame' command blocks?  Interrestingly enough, if I
>

You're trying to run the command and then collect all the output afterward;
this requires the OS to buffer potentially very large amounts of data,
whereas most OSes cache only a very small amount over a pipe.  You will
need to read the data as the command runs to avoid blocking, then close the
process once you have read EOF.

-- 
brandon s allbery                                      allbery.b at gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120320/f425a67f/attachment.htm>


More information about the Haskell-Cafe mailing list