cmd: Commander.Handle ~ CommanderOps.CreateFromStreams[
in: StandardStreams.CreateStandardInputStream[],
out: StandardStreams.CreateStandardOutputStream[]];
Inner:
PROC ~ {
result: REF ¬ $Failure;
msg: ROPE ¬ NIL;
hadFailure: BOOL ¬ FALSE;
persist: BOOL ¬ FALSE;
IF initial #
NIL
THEN {
[result: result, msg: msg] ¬ CommanderOps.ExecuteCommand[cmd, initial];
};
IF msg #
NIL
THEN {
IO.PutRope[cmd.out, msg];
IO.PutRope[cmd.out, "\n"];
};
IF result=$Failure
THEN {
IO.PutRope[cmd.out, "[[COMMANDER←INITIAL𡤌OMMAND="];
IO.PutRope[cmd.out, initial];
IO.PutRope[cmd.out, "]]\n"];
};
hadFailure ¬ CommanderOps.ReadEvalPrintLoop[cmd];
persist ¬ Rope.Size[GetEnv[cmd, "COMMANDER←INITIAL←PERSIST"]] > 0 OR Atom.GetProp[$CommanderOnStandardStreams, $DontExit]#NIL;
IF NOT persist THEN IO.PutRope[cmd.out, " Exiting Initial Commander\n"];
IF hadFailure THEN {IO.PutRope[cmd.err, " (some commands failed)\n"];};
--Hack to prevent X11Viewers from disappearing
WHILE persist DO Process.Pause[400000] ENDLOOP;
};