UnixSpawn.mesa
Copyright Ó 1989, 1990, 1991 by Xerox Corporation. All rights reserved.
Michael Plass, March 6, 1990 9:25 am PST
Peter B. Kessler, January 15, 1990 5:36:06 pm PST
DIRECTORY Rope USING [ROPE];
UnixSpawn: CEDAR DEFINITIONS ~ BEGIN OPEN Rope;
Error: ERROR [code: ATOM, msg: ROPE];
SpawnResult: TYPE = RECORD [res: INT, errno: INT, details: REF];
Spawn: PROC [
command: ROPE, wd: ROPE,
stdin: REF, stdout: REF, stderr: REF,
exec: BOOLEAN, tty: BOOLEAN, debug: BOOLEAN]
RETURNS [SpawnResult];
The command is the command to hand to a /bin/sh.
The wd is the working directory to cd to before spawning the shell.
The input REF's may be file names (ROPE, REF TEXT), or IO.STREAM's.
The returned SpawnResult.details is a LIST of the result of the spawn, errno, and the results of the stream copiers.
If exec then exec the command in the shell.
If tty then add -t /dev/tty?? and -p /dev/pty?? options to command.
If debug then print debugging info on stderr.
END.