[squeak-dev] How to use OSProcess with stdin and stdout

Martin Kuball martinkuball at web.de
Thu May 14 19:37:26 UTC 2020


Hi!

I'm trying to do some OCR from squeak using tesseract. I installed OSProcess.
So far so good. But I don't know what classes to use for stdIn and stdOut. My
code would look something like this:

| proc stdIn stdOut d |
stdIn := ???
stdOut := ???
proc := ExternalUnixOSProcess forkAndExec: '/usr/bin/tesseract' arguments:
#('-' '-' '--dpi' '100') environment: nil descriptors: (Array with: stdIn
with: stdOut with: nil).
proc ifNil: [self class noAccessorAvailable].
d := Delay forMilliseconds: 50.
[proc runState == #complete] whileFalse: [d wait].
" and now read the text from stdOut..."

Can someone fill in the blanks or point me to code that does similar things?
Thanks very much.

Martin





More information about the Squeak-dev mailing list