#REFACTORING by cg
authorClaus Gittinger <cg@exept.de>
Tue, 08 Nov 2016 22:04:41 +0100
changeset 20933 2a6274961920
parent 20932 07814037c10c
child 20934 36e46558156d
#REFACTORING by cg class: ReadEvalPrintLoop comment/format in: #documentation changed: #cmd_edit: #directive: #readEvalPrintLoop
ReadEvalPrintLoop.st
--- a/ReadEvalPrintLoop.st	Tue Nov 08 21:34:13 2016 +0100
+++ b/ReadEvalPrintLoop.st	Tue Nov 08 22:04:41 2016 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 2006 by eXept Software AG
 	      All Rights Reserved
@@ -58,6 +60,9 @@
 
     The input can is switched to non-chunk format whenever a line with a '#' in the first column appears.
 
+    Try it (but only if you have a console):
+        Smalltalk readEvalPrintLoop
+
     [Author:]
         Claus Gittinger
 "
@@ -293,17 +298,26 @@
     ].
 
     [
+        |ok|
+
         tmpFile := Filename newTemporary.
         tmpFile contents:code.
         modifiedTime := tmpFile modificationTime.
-        
-        OperatingSystem 
-            executeCommand:('%1 "%2" < /dev/tty' bindWith:editor with:tmpFile pathName)
-            inputFrom:Stdin 
-            outputTo:Stdout 
-            errorTo:Stderr.
-        
-        tmpFile modificationTime ~= modifiedTime ifTrue:[
+
+        ok := OperatingSystem 
+                executeCommand:('%1 "%2" < /dev/tty' bindWith:editor with:tmpFile pathName)
+                inputFrom:Stdin 
+                outputTo:Stdout 
+                errorTo:Stderr
+                auxFrom:nil
+                environment:nil
+                inDirectory:nil
+                lineWise:false
+                newPgrp:false
+                showWindow:true
+                onError:[:status | false].
+                
+        (ok and:[tmpFile modificationTime ~= modifiedTime]) ifTrue:[
             isNewClass ifTrue:[
                 Compiler evaluate:tmpFile contentsOfEntireFile.    
             ] ifFalse:[
@@ -325,6 +339,8 @@
         input:Stdin;
         cmd_edit:'MyClass foo' readStream
     "
+
+    "Modified: / 08-11-2016 / 21:49:56 / cg"
 !
 
 cmd_exit:lineStream
@@ -587,6 +603,7 @@
             ] do:[    
                 ControlInterrupt handle:[:ex |
                     self errorStream showCR:('Ignored in directive: ', ex description).
+                    ex reject. 
                     ex proceed. 
                 ] do:[    
                     self
@@ -602,6 +619,7 @@
     ].
 
     "Created: / 07-12-2006 / 18:49:17 / cg"
+    "Modified: / 08-11-2016 / 21:59:16 / cg"
 !
 
 showModules
@@ -817,7 +835,9 @@
         self inputStream atEnd ifTrue:[
             ex return.
         ].    
-        ex restart.
+        MiniDebugger enter.
+        ex proceed.
+        "/ ex restart.
     ] do:[
         |input output error compilerClass|
 
@@ -847,14 +867,18 @@
                 basicReadEvalPrintLoopWithInput:input output:output error:error
                 compiler:compilerClass prompt:prompt print:(printFlag ? true).
         ]
-    ]
+    ].
+    self errorStream nextPutLine:('done.').
 
     "
+     Stdin atEnd 
+     Stdin clearEOF
+     Smalltalk readEvalPrintLoop
      (ReadEvalPrintLoop new prompt:'>') readEvalPrintLoop
     "
 
     "Created: / 07-12-2006 / 17:27:21 / cg"
-    "Modified: / 06-12-2011 / 15:29:03 / cg"
+    "Modified (comment): / 08-11-2016 / 22:04:03 / cg"
 ! !
 
 !ReadEvalPrintLoop methodsFor:'queries'!