910 |
910 |
911 |offset remaining wasBlocking| |
911 |offset remaining wasBlocking| |
912 |
912 |
913 offset := initialOffset. |
913 offset := initialOffset. |
914 remaining := initialWriteCount. |
914 remaining := initialWriteCount. |
|
915 handle isNil ifTrue:[ |
|
916 self errorNotOpen. |
|
917 (self == Stderr or:[self == Stdout]) ifTrue:[ |
|
918 "Care for closed stdout and stderr, |
|
919 which happens, if the console is closed while I am running. |
|
920 In this case, we ignore the error." |
|
921 ^ initialWriteCount. |
|
922 ]. |
|
923 ^ 0. |
|
924 ]. |
915 |
925 |
916 wasBlocking := self blocking:false. |
926 wasBlocking := self blocking:false. |
917 [remaining ~~ 0] whileTrue:[ |
927 [remaining ~~ 0] whileTrue:[ |
918 |count| |
928 |count| |
919 |
929 |
920 count := super nextPutBytes:remaining from:buffer startingAt:offset. |
930 count := super nextPutBytes:remaining from:buffer startingAt:offset. |
921 |
931 |
922 remaining := remaining - count. |
932 remaining := remaining - count. |
923 offset := offset + count. |
933 offset := offset + count. |
924 remaining ~~ 0 ifTrue:[ |
934 remaining ~~ 0 ifTrue:[ |
925 "Transcript showCR:'writeWait'." |
935 "Transcript showCR:'writeWait'." |
926 self writeWait. |
936 self writeWait. |
927 ]. |
937 ]. |
928 ]. |
938 ]. |
929 wasBlocking ifTrue:[self blocking:true]. |
939 wasBlocking ifTrue:[self blocking:true]. |
930 |
940 |
931 ^ offset - initialOffset. |
941 ^ offset - initialOffset. |
932 ! ! |
942 ! ! |