[plt-scheme] Subprocess

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Jul 15 12:43:17 EDT 2002

At Mon, 15 Jul 2002 11:00:04 -0400, "Paul Steckler" wrote:
> > In the MzScheme Manual I'm able find a subprocess function that
> > given a path it'll run an executable as a subprocess, but is
> > there a way to fork? (creating a children process)
> I don't believe there is a way to fork a child process, other than
> writing an extension that calls C's fork() directly.

That's correct.

> But I'll bet that calling fork() messes up the invariants assumed by the
> MzScheme run-time.

No, I don't think so. `subprocess' does a lot of work after an internal
fork() to give a new program the right environment, but a forked
MzScheme should be happy with MzScheme's environment.

It's possible that some of the socket code assumes unique ownership of
the socket. But from a quick look, I think multiple MzSchemes for a
socket shouldn't be a problem.

Be sure to flush output ports before a fork (same problem as with
FILE*s in C).


Posted on the users mailing list.