your example still blocks any background process! the goal would be to have an stdin that only blocks the current thread (or maybe returns nil if it's empty/not ready) so you can still can do some background work.
On 2012-11-16, at 20:45, "Sean P. DeNigris" <[email protected]> wrote: > Pavel Krivanek-3 wrote >> Is there a way how to use nonblocking input from stdin? > > Not sure if this helps, but this works out of the box on 2.0 (see > https://gist.github.com/2604215): > > >> | command | >> [ >> command := FileStream stdin nextLine. >> command ~= 'exit' ] whileTrue: [ | result | >> result := Compiler evaluate: command. >> FileStream stdout nextPutAll: result asString; lf ]. >> >> Smalltalk snapshot: false andQuit: true. > > On 1.3 or 1.4, file in https://gist.github.com/2602113 first: > >> 'From Pharo2.0a of ''18 April 2012'' [Latest update: #20041] on 3 May 2012 >> at 10:45:48 pm'! >> >> !FileStream class methodsFor: 'stdio' stamp: 'SeanDeNigris 5/3/2012 >> 22:37'! >> stdin >> >> ^Stdin ifNil: [ >> Stdin := self standardIOStreamNamed: #stdin forWrite: false. >> Stdin >> disableReadBuffering; >> yourself ].! ! > > > > > > -- > View this message in context: > http://forum.world.st/nonblocking-stdin-tp4654956p4655653.html > Sent from the Pharo Smalltalk mailing list archive at Nabble.com. >
