On Thu, Nov 05, 2015 at 09:50:29PM +0000, Dimitris Chloupis wrote: > So I try to understand how OSProcess work exactly to find why filetree > seems not able to use it and generating the error I already reported > earlier. > > Using something simple like > > OSProcess command:'pwd' > > works great , I have the terminal open and I can see the correct return > value of the command in my terminal but for some reason I can find no such > info when I inspect the above example. So how exactly OSProcess returns the > output of the terminal ? Is there an instance variable of some sort ? > Because I tried to inspect it deeply and I found nothing . Can you help me > understand how OSProcess work ? Because If I do understand it then I can > find what the problem is .
Hi Dimitris, The OSProcess and CommandShell packages provide a variety of ways to create and interact with operating system processes. In the case of "OSProcess command: 'pwd'" it is starting a new unix shell (/bin/sh, which on most systems is the Bash shell). Once it starts the shell, it asks the shell to evaluate the 'pwd' command. In this case, you would see the output of that 'pwd' command appearing in the terminal window for your Pharo VM process. If you inspect the result of this, you should see an instance of ExternalUnixOSProcess. This is a proxy that represents the operating system process that was used to run /bin/sh. It should look something like this: an ExternalUnixOSProcess with pid 10703 on /bin/sh (complete, normal termination with status 0) The exitStatus instance variable of the ExternaUnixProcess should be 0 in this example, which means only that the shell ran successfully (It does not tell you exit status of the 'pwd' command in this case, although there are other ways to do that). There are other classes, especially PipeableOSProcess and CommandShell, that support higher level control of OS processes, with direct connection of the stdin/stdout/stderr streams to your Smalltalk image. I expect that filetree would be using these higher level abstractions. I don't know if this helps with your problem but maybe it gives you some ideas. Dave