daswartz wrote:We need to call UNIX shell commands from a running Smalltalk image. We can use the system: method on UNIXProcess, but for the entire time the shell is running, we see smalltalk (esnx) processes using 100% of a cpu.
If we change the UNIXProcess>>system: method to insert a Delay, ie:
| process |
process := self execute: aString.
process isNil ifTrue: [^nil].
[process isComplete] whileFalse: [(Delay forMilliseconds: 10) wait].
Smalltalk no longer uses 100% of a cpu, but we no longer get the shell scripts return value. The exitCode for the UNIXProcess is always 0.