Permalink
Browse files

Fixed a few bugs in the exec resolution

- qx{} doesn't interpolate, qqx{} does
- $code was a local argument, not an instance member
  • Loading branch information...
1 parent c536a3a commit f52dbf1dd4c73f3313621ae166b475b97077907a @cosimo committed Dec 5, 2010
Showing with 8 additions and 6 deletions.
  1. +8 −6 lib/Facter/Util/Resolution.pm
@@ -58,24 +58,26 @@ method exec($code, $interpreter = $INTERPRETER) {
# Windows' %x{} throws Errno::ENOENT when the command is not found, so we
# can skip the check there. This is good, since builtins cannot be found
# elsewhere.
- if $HAVE_WHICH and !$WINDOWS {
+ if self.have_which and !$WINDOWS {
my $path = Mu;
- my $binary = $.code.split.[0];
- if $.code ~~ /^\// {
- $path = $binary
+ my $binary = $code.split(" ").[0];
+ if $code ~~ /^\// {
+ $path = $binary;
} else {
- $path = qx{which '$binary' 2>/dev/null}.chomp;
+ Facter.debug("Trying to find which '$binary'");
+ $path = qqx{which '$binary' 2>/dev/null}.chomp;
# we don't have the binary necessary
return if $path eq "" or $path.match(/Command not found\./);
}
+ Facter.debug("path=$path");
return unless $path.IO ~~ :e;
}
my $out;
Facter.debug("Running command $code");
try {
- $out = qx{$code}.chomp;
+ $out = qqx{$code}.chomp;
}
CATCH {
Facter.debug("Command failed: $!");

0 comments on commit f52dbf1

Please sign in to comment.