--- a/TerminalSession.st Fri Aug 23 02:22:22 2013 +0200
+++ b/TerminalSession.st Fri Aug 23 13:07:51 2013 +0200
@@ -397,6 +397,10 @@
"Modified: / 5.5.1999 / 19:45:09 / cg"
!
+forgetPrompt:aString
+ promptActions removeKey:aString
+!
+
onPrompt:aString do:aBlock
"remember what to do, when a prompt arrives;
notice: will only start checking for prompt, when startCollectingOutput
@@ -501,7 +505,7 @@
!TerminalSession methodsFor:'reader process'!
collectOutputAndCheckForPrompt:buffer count:n
- |string collectedString collectedLines i lastLine|
+ |string collectedString collectedLines i i2 lastLine|
collectedOutput isNil ifTrue:[^ self].
@@ -513,7 +517,13 @@
i := collectedString lastIndexOf:Character lf.
i ~= 0 ifTrue:[
lastLine := (collectedString copyFrom:i+1) withoutTrailingSeparators.
-
+ lastLine isEmpty ifTrue:[
+ i2 := collectedString lastIndexOf:Character lf startingAt:(i-1).
+ i2 ~= 0 ifTrue:[
+ lastLine := (collectedString copyFrom:i2+1 to:i-1) withoutTrailingSeparators.
+ ].
+ ].
+ "/ Transcript show:lastLine; showCR:lastLine asByteArray.
promptActions keysAndValuesDo:[:expectedPrompt :promptAction |
((lastLine endsWith:expectedPrompt)
@@ -647,11 +657,11 @@
!TerminalSession class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/TerminalSession.st,v 1.13 2013-08-19 17:29:22 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/TerminalSession.st,v 1.14 2013-08-23 11:07:51 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic2/TerminalSession.st,v 1.13 2013-08-19 17:29:22 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/TerminalSession.st,v 1.14 2013-08-23 11:07:51 cg Exp $'
! !