[vwnc] ExternalProcess on Mac OS X

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] ExternalProcess on Mac OS X

Thomas Cleenewerck
Hello,

I have used ExternalProcess before and it worked perfectly. However  
when I used it  with unix program jhead it failed and gave the  
following criptic error: 'unhandled exception: Arguments invalid --  
wrong class'.

"failing code"
proc := ExternalProcess new.
proc  execute: 'jhead'
           arguments: rotarguments
          do: [:in :out | nil ] errorStreamDo: [:err | Transcript show: err  
contents ].
proc release.

When I tried the full path of the unix command it worked, although the  
full path is a part of  my path environment variable. Any suggestions  
what to do to resolve this?

"workaround"
proc := ExternalProcess new.
proc  execute: '/usr/local/bin/jhead'
           arguments: rotarguments
          do: [:in :out | nil ] errorStreamDo: [:err | Transcript show: err  
contents ].
proc release.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] ExternalProcess on Mac OS X

Michael Lucas-Smith-2
Thomas Cleenewerck wrote:

> Hello,
>
> I have used ExternalProcess before and it worked perfectly. However  
> when I used it  with unix program jhead it failed and gave the  
> following criptic error: 'unhandled exception: Arguments invalid --  
> wrong class'.
>
> "failing code"
> proc := ExternalProcess new.
> proc  execute: 'jhead'
>            arguments: rotarguments
>  do: [:in :out | nil ] errorStreamDo: [:err | Transcript show: err  
> contents ].
> proc release.
>
> When I tried the full path of the unix command it worked, although the  
> full path is a part of  my path environment variable. Any suggestions  
> what to do to resolve this?
>
> "workaround"
> proc := ExternalProcess new.
> proc  execute: '/usr/local/bin/jhead'
>            arguments: rotarguments
>  do: [:in :out | nil ] errorStreamDo: [:err | Transcript show: err  
> contents ].
> proc release.
>
>  
I'm not sure what your rotarguments are, should be an array.
Also, you need to read from the :in variable otherwise, the process will
end immediately. You need to attempt to read from both in and error

Cheers,
Michael
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] ExternalProcess on Mac OS X

Thomas Cleenewerck
Michael,

Circumventing the path problem, I now use the following working  
example code:

ExternalProcess fork: '/usr/local/bin/jhead' arguments: #('-autorot /
Users/thomas/Pictures/2010/DSC_8249.JPG')

However jhead uses jpegtran, another unix program, which fails to load  
because jpegtran could not be found.  I think I'm experiencing the  
same path problem. This is the error I get.

sh: jpegtran: command not found
Error : Problem executing specified command
in file '/Users/thomas/Pictures/2010/DSC_8249.JPG'

Is there a way to set the start path of a process?

Thomas.

p.s. in my terminal this works fine.

On 27 Jan 2009, at 20:26, Michael Lucas-Smith wrote:

> Thomas Cleenewerck wrote:
>> Hello,
>>
>> I have used ExternalProcess before and it worked perfectly.  
>> However  when I used it  with unix program jhead it failed and gave  
>> the  following criptic error: 'unhandled exception: Arguments  
>> invalid --  wrong class'.
>>
>> "failing code"
>> proc := ExternalProcess new.
>> proc  execute: 'jhead'
>>           arguments: rotarguments
>>  do: [:in :out | nil ] errorStreamDo: [:err | Transcript show:  
>> err  contents ].
>> proc release.
>>
>> When I tried the full path of the unix command it worked, although  
>> the  full path is a part of  my path environment variable. Any  
>> suggestions  what to do to resolve this?
>>
>> "workaround"
>> proc := ExternalProcess new.
>> proc  execute: '/usr/local/bin/jhead'
>>           arguments: rotarguments
>>  do: [:in :out | nil ] errorStreamDo: [:err | Transcript show:  
>> err  contents ].
>> proc release.
>>
>>
> I'm not sure what your rotarguments are, should be an array.
> Also, you need to read from the :in variable otherwise, the process  
> will end immediately. You need to attempt to read from both in and  
> error
>
> Cheers,
> Michael

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] ExternalProcess on Mac OS X

Michael Lucas-Smith-2
Thomas Cleenewerck wrote:

> Michael,
>
> Circumventing the path problem, I now use the following working
> example code:
>
> ExternalProcess fork: '/usr/local/bin/jhead' arguments: #('-autorot
> /Users/thomas/Pictures/2010/DSC_8249.JPG')
>
> However jhead uses jpegtran, another unix program, which fails to load
> because jpegtran could not be found.  I think I'm experiencing the
> same path problem. This is the error I get.
>
> sh: jpegtran: command not found
> Error : Problem executing specified command
> in file '/Users/thomas/Pictures/2010/DSC_8249.JPG'
>
> Is there a way to set the start path of a process?
>
Pretty much - no. Current path is actually a property of terminals, so
if you wanted to do that, you could fire up the shell, cd to the
directory you want, then run your command, eg:

ExternalProcess execute: '/bin/sh' do: [:in :out |
   out nextPutAll: 'cd ', path; cr.
   out nextPutAll: 'theprogram; exit'; cr.
   in upToEnd]
      errorStreamDo: [:err | err upToEnd]

The alternative (and less desirably) is to change the current directory
in VW before running the command, then changing back as soon as the
command is launched.

PATH is a property of terminals too.. you could read in the PATH
variable and use it to find the location of the executable.

Cheers,
Michael

> Thomas.
>
> p.s. in my terminal this works fine.
>
> On 27 Jan 2009, at 20:26, Michael Lucas-Smith wrote:
>
>> Thomas Cleenewerck wrote:
>>> Hello,
>>>
>>> I have used ExternalProcess before and it worked perfectly. However  
>>> when I used it  with unix program jhead it failed and gave the  
>>> following criptic error: 'unhandled exception: Arguments invalid --  
>>> wrong class'.
>>>
>>> "failing code"
>>> proc := ExternalProcess new.
>>> proc  execute: 'jhead'
>>>           arguments: rotarguments
>>>       do: [:in :out | nil ] errorStreamDo: [:err | Transcript show:
>>> err  contents ].
>>> proc release.
>>>
>>> When I tried the full path of the unix command it worked, although
>>> the  full path is a part of  my path environment variable. Any
>>> suggestions  what to do to resolve this?
>>>
>>> "workaround"
>>> proc := ExternalProcess new.
>>> proc  execute: '/usr/local/bin/jhead'
>>>           arguments: rotarguments
>>>       do: [:in :out | nil ] errorStreamDo: [:err | Transcript show:
>>> err  contents ].
>>> proc release.
>>>
>>>
>> I'm not sure what your rotarguments are, should be an array.
>> Also, you need to read from the :in variable otherwise, the process
>> will end immediately. You need to attempt to read from both in and error
>>
>> Cheers,
>> Michael
>
>

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] ExternalProcess on Mac OS X

Eliot Miranda-2


On Tue, Jan 27, 2009 at 12:05 PM, Michael Lucas-Smith <[hidden email]> wrote:
Thomas Cleenewerck wrote:
> Michael,
>
> Circumventing the path problem, I now use the following working
> example code:
>
> ExternalProcess fork: '/usr/local/bin/jhead' arguments: #('-autorot
> /Users/thomas/Pictures/2010/DSC_8249.JPG')
>
> However jhead uses jpegtran, another unix program, which fails to load
> because jpegtran could not be found.  I think I'm experiencing the
> same path problem. This is the error I get.
>
> sh: jpegtran: command not found
> Error : Problem executing specified command
> in file '/Users/thomas/Pictures/2010/DSC_8249.JPG'
>
> Is there a way to set the start path of a process?
>
Pretty much - no. Current path is actually a property of terminals,

More correctly it is a property of shells, but for utility it is also built into the C library.  See e.g. execlp(3), execvp(3) & execvP(3).

You'll find code to search PATH in the Unix VMs, see e.g. findInPath which is used in primFork (prim #681), so 'jhead' should work fine if /usr/local/bin is in the PATH.

The problem might be that the user needs to provide the program as the first argument to the array also.

What happens if the user tries

ExternalProcess fork: /jhead' arguments: #('jhead' '-autorot' '/Users/thomas/Pictures/2010/DSC_8249.JPG')

?

HTH
so
if you wanted to do that, you could fire up the shell, cd to the
directory you want, then run your command, eg:

ExternalProcess execute: '/bin/sh' do: [:in :out |
  out nextPutAll: 'cd ', path; cr.
  out nextPutAll: 'theprogram; exit'; cr.
  in upToEnd]
     errorStreamDo: [:err | err upToEnd]

The alternative (and less desirably) is to change the current directory
in VW before running the command, then changing back as soon as the
command is launched.

PATH is a property of terminals too.. you could read in the PATH
variable and use it to find the location of the executable.

Cheers,
Michael
> Thomas.
>
> p.s. in my terminal this works fine.
>
> On 27 Jan 2009, at 20:26, Michael Lucas-Smith wrote:
>
>> Thomas Cleenewerck wrote:
>>> Hello,
>>>
>>> I have used ExternalProcess before and it worked perfectly. However
>>> when I used it  with unix program jhead it failed and gave the
>>> following criptic error: 'unhandled exception: Arguments invalid --
>>> wrong class'.
>>>
>>> "failing code"
>>> proc := ExternalProcess new.
>>> proc  execute: 'jhead'
>>>           arguments: rotarguments
>>>       do: [:in :out | nil ] errorStreamDo: [:err | Transcript show:
>>> err  contents ].
>>> proc release.
>>>
>>> When I tried the full path of the unix command it worked, although
>>> the  full path is a part of  my path environment variable. Any
>>> suggestions  what to do to resolve this?
>>>
>>> "workaround"
>>> proc := ExternalProcess new.
>>> proc  execute: '/usr/local/bin/jhead'
>>>           arguments: rotarguments
>>>       do: [:in :out | nil ] errorStreamDo: [:err | Transcript show:
>>> err  contents ].
>>> proc release.
>>>
>>>
>> I'm not sure what your rotarguments are, should be an array.
>> Also, you need to read from the :in variable otherwise, the process
>> will end immediately. You need to attempt to read from both in and error
>>
>> Cheers,
>> Michael
>
>

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] ExternalProcess on Mac OS X

Thomas Cleenewerck
In reply to this post by Michael Lucas-Smith-2
I've found for sure what is causing the problem. The reason that the  
executable is not found is because the PATH variable is different when  
running /bin/sh from VW than from a terminal window.

 From VW i get
        /usr/bin:/bin:/usr/sbin:/sbin

 From the terminal i get:
        /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/
texbin:/usr/local/bin:/usr/local/bin:/Users/thomas/.bin

Is it possible to pass another PATH variable by adjusting the  
environment ?

Thomas.

On 27 Jan 2009, at 21:05, Michael Lucas-Smith wrote:

> Thomas Cleenewerck wrote:
>> Michael,
>>
>> Circumventing the path problem, I now use the following working  
>> example code:
>>
>> ExternalProcess fork: '/usr/local/bin/jhead' arguments: #('-
>> autorot /Users/thomas/Pictures/2010/DSC_8249.JPG')
>>
>> However jhead uses jpegtran, another unix program, which fails to  
>> load because jpegtran could not be found.  I think I'm experiencing  
>> the same path problem. This is the error I get.
>>
>> sh: jpegtran: command not found
>> Error : Problem executing specified command
>> in file '/Users/thomas/Pictures/2010/DSC_8249.JPG'
>>
>> Is there a way to set the start path of a process?
>>
> Pretty much - no. Current path is actually a property of terminals,  
> so if you wanted to do that, you could fire up the shell, cd to the  
> directory you want, then run your command, eg:
>
> ExternalProcess execute: '/bin/sh' do: [:in :out |
>  out nextPutAll: 'cd ', path; cr.
>  out nextPutAll: 'theprogram; exit'; cr.
>  in upToEnd]
>     errorStreamDo: [:err | err upToEnd]
>
> The alternative (and less desirably) is to change the current  
> directory in VW before running the command, then changing back as  
> soon as the command is launched.
>
> PATH is a property of terminals too.. you could read in the PATH  
> variable and use it to find the location of the executable.
>
> Cheers,
> Michael
>> Thomas.
>>
>> p.s. in my terminal this works fine.
>>
>> On 27 Jan 2009, at 20:26, Michael Lucas-Smith wrote:
>>
>>> Thomas Cleenewerck wrote:
>>>> Hello,
>>>>
>>>> I have used ExternalProcess before and it worked perfectly.  
>>>> However  when I used it  with unix program jhead it failed and  
>>>> gave the  following criptic error: 'unhandled exception:  
>>>> Arguments invalid --  wrong class'.
>>>>
>>>> "failing code"
>>>> proc := ExternalProcess new.
>>>> proc  execute: 'jhead'
>>>>          arguments: rotarguments
>>>>      do: [:in :out | nil ] errorStreamDo: [:err | Transcript  
>>>> show: err  contents ].
>>>> proc release.
>>>>
>>>> When I tried the full path of the unix command it worked,  
>>>> although the  full path is a part of  my path environment  
>>>> variable. Any suggestions  what to do to resolve this?
>>>>
>>>> "workaround"
>>>> proc := ExternalProcess new.
>>>> proc  execute: '/usr/local/bin/jhead'
>>>>          arguments: rotarguments
>>>>      do: [:in :out | nil ] errorStreamDo: [:err | Transcript  
>>>> show: err  contents ].
>>>> proc release.
>>>>
>>>>
>>> I'm not sure what your rotarguments are, should be an array.
>>> Also, you need to read from the :in variable otherwise, the  
>>> process will end immediately. You need to attempt to read from  
>>> both in and error
>>>
>>> Cheers,
>>> Michael
>>
>>
>

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] ExternalProcess on Mac OS X

Antony Blakey-2
In reply to this post by Eliot Miranda-2

On 28/01/2009, at 7:02 AM, Eliot Miranda wrote:

>
>
> On Tue, Jan 27, 2009 at 12:05 PM, Michael Lucas-Smith <[hidden email]
> > wrote:
> Thomas Cleenewerck wrote:
> > Michael,
> >
> > Circumventing the path problem, I now use the following working
> > example code:
> >
> > ExternalProcess fork: '/usr/local/bin/jhead' arguments: #('-autorot
> > /Users/thomas/Pictures/2010/DSC_8249.JPG')
> >
> > However jhead uses jpegtran, another unix program, which fails to  
> load
> > because jpegtran could not be found.  I think I'm experiencing the
> > same path problem. This is the error I get.
> >
> > sh: jpegtran: command not found
> > Error : Problem executing specified command
> > in file '/Users/thomas/Pictures/2010/DSC_8249.JPG'
> >
> > Is there a way to set the start path of a process?
> >
> Pretty much - no. Current path is actually a property of terminals,
>
> More correctly it is a property of shells, but for utility it is  
> also built into the C library.  See e.g. execlp(3), execvp(3) &  
> execvP(3).
>
> You'll find code to search PATH in the Unix VMs, see e.g. findInPath  
> which is used in primFork (prim #681), so 'jhead' should work fine  
> if /usr/local/bin is in the PATH.

I've dealt with this. The problem is that if you double-click to  
launch VW, then your .bashrc/.profile isn't read, hence your path  
isn't setup. You need to set the PATH in ~/.MacOSX/environment.plist  
if you want apps launched from other-than-the-command-line to see it.

If you don't modify /.MacOSX/environment.plist (and I suggest you  
don't), then you have to do as Michael says and launch a shell from  
the ExternalProcess, and then treat your 'real' commands as arguments  
to the shell.

Antony Blakey
--------------------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

I contend that we are both atheists. I just believe in one fewer god  
than you do. When you understand why you dismiss all the other  
possible gods, you will understand why I dismiss yours.
   --Stephen F Roberts


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] ExternalProcess on Mac OS X

Antony Blakey-3

On 28/01/2009, at 7:14 AM, Antony Blakey wrote:

> I've dealt with this. The problem is that if you double-click to  
> launch VW, then your .bashrc/.profile isn't read, hence your path  
> isn't setup. You need to set the PATH in ~/.MacOSX/environment.plist  
> if you want apps launched from other-than-the-command-line to see it.
>
> If you don't modify /.MacOSX/environment.plist (and I suggest you  
> don't), then you have to do as Michael says and launch a shell from  
> the ExternalProcess, and then treat your 'real' commands as  
> arguments to the shell.

BTW: this is documented here: http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html

Antony Blakey
-------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

It is no measure of health to be well adjusted to a profoundly sick  
society.
   -- Jiddu Krishnamurti


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] ExternalProcess on Mac OS X

Antony Blakey-2
In reply to this post by Antony Blakey-2

On 28/01/2009, at 7:14 AM, Antony Blakey wrote:

> I've dealt with this. The problem is that if you double-click to  
> launch VW, then your .bashrc/.profile isn't read, hence your path  
> isn't setup. You need to set the PATH in ~/.MacOSX/environment.plist  
> if you want apps launched from other-than-the-command-line to see it.
>
> If you don't modify /.MacOSX/environment.plist (and I suggest you  
> don't), then you have to do as Michael says and launch a shell from  
> the ExternalProcess, and then treat your 'real' commands as  
> arguments to the shell.

BTW: this is documented here:http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html

Antony Blakey
-------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

One should respect public opinion insofar as is necessary to avoid  
starvation and keep out of prison, but anything that goes beyond this  
is voluntary submission to an unnecessary tyranny.
   -- Bertrand Russell


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] ExternalProcess on Mac OS X

Reinout Heeck
In reply to this post by Eliot Miranda-2


>     Pretty much - no. Current path is actually a property of terminals,
>
>
> More correctly it is a property of shells, but for utility it is also
> built into the C library.  See e.g. execlp(3), execvp(3) & execvP(3).


These remarks surprise me.

I always thought that 'the environment' was a property of processes.

If a process spawns a new one it can set up the env for the new process
or leave it implied (in which case the child gets a copy of the parent
process' env).


So I /guess/ you can simply set the path in the environment of the VW
process, and the spawned utilities will inherit it.

Something like:

   CEnvironment setenv:
     (CEnvironment getenv: 'PATH') , ';/usr/local/bin'





Another option would be to launch a shell in 'login shell' mode (so it
sets the users preferred path), but I don't know how that exactly works
and expect it to be very brittle (permission problems depending on how
apps are launched and such).




HTH,

Reinout
-------
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] ExternalProcess on Mac OS X

thomas.hawker
Reinout,

Starting a shell as a "login shell" is merely a trick, nothing more, but I don't know enough about the external process interface to know whether you can do it.  Normally, you execute a program with [up to] three arguments:  the path to the executable, the argument list, and the environment list.  The first argument is usually the same as the executable.  To create a login shell, however, change the first argument from something like "/bin/csh" to just "-csh" - that is, strip the directory path and prefix with a dash.  That's all it takes.

Cheers!
 
Tom Hawker
--------------------------
Senior Framework Developer
--------------------------
Home +1 (408) 274-4128
Office +1 (408) 576-6591
Mobile +1 (408) 835-3643
 

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Reinout Heeck
Sent: Wednesday, January 28, 2009 1:31 AM
To: VW NC
Subject: Re: [vwnc] ExternalProcess on Mac OS X



>     Pretty much - no. Current path is actually a property of terminals,
>
>
> More correctly it is a property of shells, but for utility it is also
> built into the C library.  See e.g. execlp(3), execvp(3) & execvP(3).


These remarks surprise me.

I always thought that 'the environment' was a property of processes.

If a process spawns a new one it can set up the env for the new process
or leave it implied (in which case the child gets a copy of the parent
process' env).


So I /guess/ you can simply set the path in the environment of the VW
process, and the spawned utilities will inherit it.

Something like:

   CEnvironment setenv:
     (CEnvironment getenv: 'PATH') , ';/usr/local/bin'





Another option would be to launch a shell in 'login shell' mode (so it
sets the users preferred path), but I don't know how that exactly works
and expect it to be very brittle (permission problems depending on how
apps are launched and such).




HTH,

Reinout
-------
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


IMPORTANT NOTICE
Email from OOCL is confidential and may be legally privileged.  If it is not intended for you, please delete it immediately unread.  The internet cannot guarantee that this communication is free of viruses, interception or interference and anyone who communicates with us by email is taken to accept the risks in doing so.  Without limitation, OOCL and its affiliates accept no liability whatsoever and howsoever arising in connection with the use of this email.  Under no circumstances shall this email constitute a binding agreement to carry or for provision of carriage services by OOCL, which is subject to the availability of carrier's equipment and vessels and the terms and conditions of OOCL's standard bill of lading which is also available at http://www.oocl.com.

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] ExternalProcess on Mac OS X

Travis Griggs-3

On Jan 28, 2009, at 6:51 AM, <[hidden email]> wrote:

> Reinout,
>
> Starting a shell as a "login shell" is merely a trick, nothing more,  
> but I don't know enough about the external process interface to know  
> whether you can do it.  Normally, you execute a program with [up to]  
> three arguments:  the path to the executable, the argument list, and  
> the environment list.  The first argument is usually the same as the  
> executable.  To create a login shell, however, change the first  
> argument from something like "/bin/csh" to just "-csh" - that is,  
> strip the directory path and prefix with a dash.  That's all it takes.

sh -l -c "programName and arguments"

Aside, I swore off the C-shell after reading pages like the following:
http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/

--
Travis Griggs
Objologist
"Only one thing is impossible for God: to find any sense in any  
copyright law on the planet." - Mark Twain


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] ExternalProcess on Mac OS X

Eliot Miranda-2
In reply to this post by Reinout Heeck


On Wed, Jan 28, 2009 at 1:31 AM, Reinout Heeck <[hidden email]> wrote:


>     Pretty much - no. Current path is actually a property of terminals,
>
>
> More correctly it is a property of shells, but for utility it is also
> built into the C library.  See e.g. execlp(3), execvp(3) & execvP(3).


These remarks surprise me.

I always thought that 'the environment' was a property of processes.

Yes, but PATH is merely an environment variable, not the whole environment, and a convention used by shells with a little support from the C library (execlp et al above).

If a process spawns a new one it can set up the env for the new process
or leave it implied (in which case the child gets a copy of the parent
process' env).

Right.  But Mac OS X's launching conventions mean that double-clicked applications don't inherit the current user's environment.
 
So I /guess/ you can simply set the path in the environment of the VW
process, and the spawned utilities will inherit it.

Something like:

  CEnvironment setenv:
    (CEnvironment getenv: 'PATH') , ';/usr/local/bin'

which would be great except that setenv: isn't supported (at least not on Unix as of 7.5)
 
Another option would be to launch a shell in 'login shell' mode (so it
sets the users preferred path), but I don't know how that exactly works
and expect it to be very brittle (permission problems depending on how
apps are launched and such).

not to mention the overhead of starting a shell just to run another process :)
 





HTH,

Reinout
-------
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc