TerminalSession.st
changeset 4641 561fd5fdf03c
parent 4639 3e5713fe4685
child 4642 695b02c145a9
equal deleted inserted replaced
4640:84130c41071a 4641:561fd5fdf03c
   774     "look for the session's output"
   774     "look for the session's output"
   775 
   775 
   776     StreamError handle:[:ex |
   776     StreamError handle:[:ex |
   777         Transcript show:'Terminal(PTY-reader) [error]: '; showCR:ex description.
   777         Transcript show:'Terminal(PTY-reader) [error]: '; showCR:ex description.
   778     ] do:[
   778     ] do:[
       
   779         |outStreamWasNonNil|
       
   780 
       
   781         outStreamWasNonNil := false.
   779         [true] whileTrue:[
   782         [true] whileTrue:[
   780             AbortOperationRequest handle:[:ex |
   783             AbortOperationRequest handle:[:ex |
   781                 ^ self
   784                 ^ self
   782             ] do:[
   785             ] do:[
   783                 |n sensor|
   786                 |n sensor|
   784 
   787 
   785                 readerDelay notNil ifTrue:[ Delay waitForSeconds:readerDelay].
   788                 readerDelay notNil ifTrue:[ Delay waitForSeconds:readerDelay].
   786                 outStream isNil ifTrue:[
   789                 outStream isNil ifTrue:[
       
   790                     outStreamWasNonNil ifTrue:[^ self].
   787                     Delay waitForSeconds:0.1
   791                     Delay waitForSeconds:0.1
   788                 ] ifFalse:[
   792                 ] ifFalse:[
       
   793                     outStreamWasNonNil := true.
   789                     outStream readWait.
   794                     outStream readWait.
   790 
   795 
   791                     (pluggableCheckBeforeReadAction isNil
   796                     (pluggableCheckBeforeReadAction isNil
   792                     or:[pluggableCheckBeforeReadAction value]) ifTrue:[
   797                     or:[pluggableCheckBeforeReadAction value]) ifTrue:[
   793                         n := self readAnyAvailableData.
   798                         n := self readAnyAvailableData.
   794                         n == 0 ifTrue:[
   799                         n == 0 ifTrue:[
   795                             "/ Windows IPC has a bug - it always
   800                             "/ Windows IPC has a bug - it always
   796                             "/ returns 0 (when the command is idle)
   801                             "/ returns 0 (when the command is idle)
   797                             "/ and says it's at the end (sigh)
   802                             "/ and says it's at the end (sigh)
   798 
       
   799                             OperatingSystem isMSWINDOWSlike ifTrue:[
   803                             OperatingSystem isMSWINDOWSlike ifTrue:[
   800                                 Delay waitForSeconds:0.1
   804                                 Delay waitForSeconds:0.1
   801                             ] ifFalse:[
   805                             ] ifFalse:[
   802                                 outStream atEnd ifTrue:[
   806                                 outStream atEnd ifTrue:[
   803                                     outStream close. outStream := nil.
   807                                     outStream close. outStream := nil.
   804                                     inStream close.  inStream := nil.
   808                                     inStream close.  inStream := nil.
   805                                     Processor activeProcess terminate.
   809                                     Processor activeProcess terminate.
   806                                 ] ifFalse:[
   810                                 ] ifFalse:[
   807                                     "/ this should not happen.
   811                                     "/ this should not happen.
   808 
       
   809                                     Delay waitForSeconds:0.1
   812                                     Delay waitForSeconds:0.1
   810                                 ]
   813                                 ]
   811                             ].
   814                             ].
   812                         ]
   815                         ]
   813                     ]
   816                     ]
   850     (p := readerProcess) notNil ifTrue:[
   853     (p := readerProcess) notNil ifTrue:[
   851         readerProcess := nil.
   854         readerProcess := nil.
   852         p terminate.
   855         p terminate.
   853         "/ give it a chance to really terminate
   856         "/ give it a chance to really terminate
   854         Processor yield.
   857         Processor yield.
       
   858         "/ read any remaining data
       
   859         (self readAnyAvailableData > 0) ifTrue:[
       
   860             self halt:'to check if this solves the make problem'.
       
   861         ].
   855     ].
   862     ].
   856 ! !
   863 ! !
   857 
   864 
   858 !TerminalSession class methodsFor:'documentation'!
   865 !TerminalSession class methodsFor:'documentation'!
   859 
   866