On Sep 26, 2008, at 8:03 AM, Randal L. Schwartz wrote:
"Randal" == Randal L Schwartz merlyn@stonehenge.com writes:
"Bert" == Bert Freudenberg bert@freudenbergs.de writes:
Bert> Am 26.09.2008 um 05:12 schrieb Mark Volkmann:
Is it possible to run a Squeak program from a terminal window and have access to the stdin and stdout streams from the Smalltalk code?
And the longer still answer (now that I've noticed "access to stdin and stdout") is to use an image with OSProcess loaded, and then you can get access as follows:
me := ThisOSProcess thisOSProcess. stdin := me stdIn. "acts like a Stream" stdout := me stdOut. stderr := me stdErr. stderr print: Time now; cr. "put the time of day on my stderr output"
Thanks for the example code! Now I think all I need is to find out how to launch the code from a terminal window. At http://wiki.squeak.org/squeak/1914 I found this.
"To initiate external shell processing, evaluate ''ExternalCommandShell stop'', save the image, and restart with ''squeak -headless myImage''."
It's not clear to me what will be run when that last command is executed from a terminal window. Where would I put code like your example code above and how does the squeak command know to execute it?
--- Mark Volkmann