[Pharo-project] Small question in OSProcess

Stéphane Ducasse stephane.ducasse at inria.fr
Fri May 13 08:53:38 CEST 2011

thanks david for your explanations!

On May 12, 2011, at 11:13 PM, David T. Lewis wrote:

> On Tue, May 10, 2011 at 04:02:02PM +0200, Adrien BARREAU wrote:
>> Hi all, 
>> I just have a little question: 
>>    Is there a way to change the working directory of my terminal with something in OSProcess?
>> I mean:
>> - I know I can change the working directory of the current process with "OSProcess thisOSProcess chDir: '/'" but of course it does nothing on the terminal
>> - "OSProcess thisOSProcess command: 'cd /'" does absolutly nothing
>> I hope it's clean enough.
>> Regards, 
>> Adrien.
> The Unix or Windows concept of "current working directory" does not
> really have any meaning in Squeak/Pharo itself. In Unix, which maintains
> a single tree structured view of the file system(s), you may think of
> it as associated with the shell that you are running. In Windows it
> is similar but needs to accommodate the idea of separate volumes
> (C:, D:, etc).
> The CommandShell package is a companion to OSProcess that implements
> a simulation of Unix and Windows shell behaviour. Try loading CommandShell
> in addition to OSProcess and I think that you will find what you are
> looking for.
> If your question refers to a Unix (Linux, OS X, etc) platform, and you
> are trying to do is change the current working directory for the terminal
> from which you started your Pharo image, then it's a different issue.
> This is basic Unix behavior - the program you are running (the VM) is
> a child process of the program that started it (the shell in your
> terminal window). A child process does not have access to its parent
> process to do things like change its working directory. So when you
> are doing things such as setting environment variables and so forth,
> it affects the process that you are current in (the VM process), and
> has no effect on the parent (the shell in your terminal window).
> HTH,
> Dave

More information about the Pharo-project mailing list