Hi Sean,
An fread() call will block when reading from a unix pipe unless the pipe
end has been set to nonblocking mode (see #primSQFileSetNonBlocking:).
So the #upToEnd problem was solved by sending #setNonBlockingOutput. So the following simple in-image ssh client works:
p := PipeableOSProcess command: '/usr/bin/expect /path/to/expect_file.exp ', password, ' ', ipAddress.
p setNonBlockingOutput. "This was added. Otherwise, #upToEnd hangs the image"
p nextPutAll: 'ls', Character cr asString.
p upToEnd.
p nextPutAll: 'pwd', Character cr asString.
p upToEnd.
The reason that I didn't think to do this before is that I thought the whole point of #upToEnd was that it was *inherently* non-blocking...
- Open a test runner and run CommandShellTestCase...
Yes, they all passed except the PipeableOSProcessTestCase ones...
The other problem ("p := PipeableOSProcess waitForCommand: 'ps -ax -o pid,command'" hangs forever) is not happening right now. It's returning as soon as the process is finished, so I'll have to get back to you if it pops up again...