added output protocol specification;
authorwenzelm
Fri, 14 Dec 2007 21:15:37 +0100
changeset 25631 9036ccd685b4
parent 25630 98dd706319a1
child 25632 01a8d27a0857
added output protocol specification; PID: always on new line;
src/Pure/Tools/isabelle_process.ML
--- a/src/Pure/Tools/isabelle_process.ML	Fri Dec 14 21:15:36 2007 +0100
+++ b/src/Pure/Tools/isabelle_process.ML	Fri Dec 14 21:15:37 2007 +0100
@@ -3,6 +3,18 @@
     Author:     Makarius
 
 Isabelle process wrapper -- interaction via external program.
+
+General format of process output:
+
+  (a) unmarked stdout/stderr, no line structure (output should be
+  processed immediately as it arrives)
+
+  (b) echo of my pid on stdout, appears *relatively* early after
+  startup on a separate line, e.g. "\nPID=4711\n"
+
+  (c) properly marked-up messages, e.g. for writeln channel
+  "\002A" ^ text ^ "\002.\n" where the body text may consist of several
+  lines (output should be processed in one piece).
 *)
 
 signature ISABELLE_PROCESS =
@@ -52,7 +64,7 @@
 (* init *)
 
 fun init () =
- (Output.writeln_default ("PID=" ^ string_of_pid (Posix.ProcEnv.getpid ()));
+ (Output.writeln_default ("\nPID=" ^ string_of_pid (Posix.ProcEnv.getpid ()));
   setup_channels ();
   Isar.secure_main ());