--- a/mercurial/HGChangesetFile.st Wed Dec 06 03:34:16 2017 +0100
+++ b/mercurial/HGChangesetFile.st Fri Jan 19 22:42:30 2018 +0100
@@ -399,52 +399,16 @@
(old behavior, will vanish:)the block is evaluated with a nil argument.
Ensures that the stream is closed."
- |stream result|
+ |stream|
stream := self readStream.
- [
- result := aBlock value:stream
+ ^ [
+ aBlock value:stream
] ensure:[
stream notNil ifTrue:[stream close]
].
- ^ result
- "
- read the first line from some file:
-
- |rslt|
-
- rslt :=
- '/etc/passwd' asFilename
- readingFileDo:[:s |
- s nextLine
- ].
- Transcript showCR:rslt.
- "
-
- "
- find all used shells in /etc/passwd and count their usage:
-
- |rslt|
-
- rslt :=
- '/etc/passwd' asFilename
- readingFileDo:
- [:s |
- |shells|
-
- shells := Bag new.
- s linesDo:
- [:line |
- |parts|
-
- parts := line asCollectionOfSubstringsSeparatedBy:$:.
- shells add:(parts seventh).
- ].
- shells contents
- ].
- Transcript showCR:rslt.
- "
+ "Modified (comment): / 12-01-2018 / 18:23:20 / stefan"
!
readingLinesDo:aBlock