El 4 feb 2022, a las 17:48, bajger@gmail.com escribi��:Greetings Pharoers!
I have following problem when using OSSubprocess library. If I run a method that uses code below, it fails: Error: Error: posix_spawn(), code: 9, description: Bad file descriptor
Any thoughts, hints are welcome!
My code redirects stdout, stdin in order to catch system outputs from inside of Pharo.
Subprocess code does following: OSUnixSubprocess>>runAndWaitWithStdOutputselfredirectStdout;redirectStderr;runAndWaitOnExitDo: [ :termProcess :outString :errString |termProcess isSuccessifTrue: [ ^ outString ]ifFalse: [ "commands to handle ex message here" ] ]Now if I run, it fails: Error: Error: posix_spawn(), code: 9, description: Bad file descriptor OSSUnixSystemAccessor(Object)>>error: OSSUnixSystemAccessor>>strerror:message: OSSUnixSubprocess>>internalRun [ self internalRun ] in OSSUnixSubprocess>>run in Block: [ self internalRun ] BlockClosure>>ensure: OSSUnixSubprocess>>run OSSUnixSubprocess>>runAndWaitOnExitDo: OSSUnixSubprocess>>runAndWaitWithStdOutput ... .. . PhLImageProcessListCliCommand(PhLCliCommand)>>executeOSShellCommand So it seems that OSUnixSubprocess uses some file that remains opened probably in OS? Command that is passed to OSSubprocess is generated by args: ^ Array with: 'echo' with: '-n' with: ('$(pgrep -a -f Pharo | grep ''.image'' | grep -v ''.bash''| grep -v {1})' format: {self currentVMPid asString})