Hi David, What is the function that is actually failing? I would assume it’s something called in #internalRun.
I assume you have tried executing the process from the command line (quick check I always do when finding these kind of problems :P). $ echo -n $(pgrep -a -f Pharo | grep ''.image'' | grep -v ''.bash''| grep -v XXX) G > El 4 feb 2022, a las 17:48, baj...@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>>runAndWaitWithStdOutput > self > redirectStdout; > redirectStderr; > runAndWaitOnExitDo: [ :termProcess :outString :errString | > termProcess isSuccess > ifTrue: [ ^ 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})