[Haskell-cafe] Re: Running a "sub-process" which dies with the main program

Deniz Dogan deniz.a.m.dogan at gmail.com
Fri Jun 19 05:58:26 EDT 2009

2009/6/18 Deniz Dogan <deniz.a.m.dogan at gmail.com>:
> Hi
> I couldn't come up with a better subject than this one, so anyways...
> I have a small program which spawns a subprocess. However, when I hit
> C-c, the subprocess won't die, instead it will just keep running until
> it's done or until I kill it. I've looked around in System.Process for
> something suitable for my needs, but I can't seem to find it. Any
> ideas?

With a tip from a person outside of the mailing list I found
System.Process.system, which essentially does exactly what I was
asking for. However, I would really like some more control over what
file descriptors the subprocess should use (specifically stdout and
stderr). Looking at the source code for System.Process.system, I find
that it uses the "syncProcess" function, which would be useful to me,
but isn't exported.

So why is syncProcess not exported? Is there any good reason not to?

Deniz Dogan

More information about the Haskell-Cafe mailing list