Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[linuxtools-dev] Two solutions for the $PATH problem

I talked briefly with Jeff Johnston and he made the point that you can
use a script to get around this problem of not having PATH set at the
time command is invoked.  In fact, this approach is already taken in
org.eclipse.linuxtools.profiling.launch.createProcess.  Basically, you
create a [remote] file, and fill it with

#! /bin/sh
<commmand> <args...>

Then run it by executing "/bin/sh <name of created file>".  Because this
new shell will have the $PATH variable set completely, you will get the
correct executable.

The second approach is a little better in my opinion because you don't
have to create any [remote] files.  That solution is to call
"/usr/bin/which <command>" with the $PATH set as you like.  Because
/usr/bin/which works with the $PATH that is passed to it, it should
return the absolute path of the correct executable to use.  Then you
just use that path to run the desired tool.

- Corey


Back to the top