tags:

views:

56

answers:

1

I'm trying to debug a cons script, and the problem I'm having is that an executable in my own $PATH doesn't seem to be located. In short: Can cons find executables in my path?

This might seem like a silly question, since the FAQ says

Cons does not pass the user's environment to the child processes that it forks to build the software. Anything you need or want to pass in from the user's environment must be done so explicitly.

It's not clear to me, however, that cons shouldn't be able to see my $PATH (the above is worded such that I wouldn't expect child processes to have access to any of the environment variables). In the execution of the Construct, $PATH evaluates to empty but $ENV{PATH} does contain my path.

It doesn't help that I don't know cons nor Perl, so I don't really know what I'm doing, nor where to start looking for what's causing the problem :) For what it's worth, the script that doesn't work for me, but does work for the original author of the script, is located here.

+1  A: 

For what it's worth, the guideline in the FAQ is correct in that something like this will fix the problem:

# A standard construction environment.
$env = new cons(
   ENV => { PATH => $ENV{PATH} }
);

which can then be followed by, e.g.,

Command $env 'foo', qq(echo =`which tex`=);

to run/install/build/whatever you're doing with the cons script.

Will Robertson