- # We do a little dance, as $path_builder might return a list of
- # more than one. If so, only the first is to be considered a
- # program to fix up, the rest is part of the arguments. This
- # happens for perl scripts, where $path_builder will return
- # a list of two, $^X and the script name.
- # Also, if $path_builder returned more than one, we don't apply
- # the EXE_SHELL environment variable.
- my @prog = ($path_builder->(shift @cmdarray));
- my $first = shift @prog;
- my $exe_shell = @prog ? undef : $ENV{EXE_SHELL};
- my $cmd = __fixup_cmd($first, $exe_shell);
- if (@prog) {
- if ( ! -f $prog[0] ) {
- print STDERR "$prog[0] not found\n";
- $cmd = undef;
- }
- }
- my @args = (@prog, @cmdarray);
- if (defined($opts{interpreter_args})) {
- unshift @args, @{$opts{interpreter_args}};
- }
-
- return () if !$cmd;
-
- my $arg_str = "";