--- a/src/Pure/General/source.ML Fri Dec 07 15:08:09 2007 +0100
+++ b/src/Pure/General/source.ML Fri Dec 07 17:40:05 2007 +0100
@@ -122,15 +122,16 @@
in maps explode (slurp ()) end;
fun drain_stream instream outstream prompt () =
- let val input = slurp_input instream in
+ let
+ val input = slurp_input instream;
+ fun output_prompt () = NAMED_CRITICAL "IO" (fn () =>
+ (TextIO.output (outstream, Output.output prompt); TextIO.flushOut outstream));
+ in
if exists (fn c => c = "\n") input then (input, ())
else
- (case
- (TextIO.output (outstream, Output.output prompt);
- TextIO.flushOut outstream;
- TextIO.inputLine instream) of
- SOME line => (input @ explode line, ())
- | NONE => (input, ()))
+ (case (output_prompt (); TextIO.inputLine instream) of
+ SOME line => (input @ explode line, ())
+ | NONE => (input, ()))
end;
fun of_stream instream outstream =