summaryrefslogtreecommitdiffstats
path: root/perl-install/run_program.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-10-07 08:05:51 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-10-07 08:05:51 +0000
commit7e1cf22e89eb8e56bd4066de53f3cd1344f559dc (patch)
treea9e9e8b2412e8405dc31dd4f50e84b78267eae3b /perl-install/run_program.pm
parentd44c42bbe39b4a4deb429482a1804400ab88063f (diff)
downloaddrakx-7e1cf22e89eb8e56bd4066de53f3cd1344f559dc.tar
drakx-7e1cf22e89eb8e56bd4066de53f3cd1344f559dc.tar.gz
drakx-7e1cf22e89eb8e56bd4066de53f3cd1344f559dc.tar.bz2
drakx-7e1cf22e89eb8e56bd4066de53f3cd1344f559dc.tar.xz
drakx-7e1cf22e89eb8e56bd4066de53f3cd1344f559dc.zip
fix buggy previous commit, cleanup and correctly indent. previous commit was:
do not clober output files (stdout or stderr) when binary cannot be found (#18987)
Diffstat (limited to 'perl-install/run_program.pm')
-rw-r--r--perl-install/run_program.pm12
1 files changed, 10 insertions, 2 deletions
diff --git a/perl-install/run_program.pm b/perl-install/run_program.pm
index b1b871076..0e6ede3b4 100644
--- a/perl-install/run_program.pm
+++ b/perl-install/run_program.pm
@@ -63,6 +63,11 @@ sub raw {
my $stdout = $stdout_raw && (ref($stdout_raw) ? $tmpdir->() . "/.drakx-stdout.$$" : "$root$stdout_raw");
my $stderr = $stderr_raw && (ref($stderr_raw) ? $tmpdir->() . "/.drakx-stderr.$$" : "$root$stderr_raw");
+ if (! ($real_name =~ m!^/! ? -x $real_name : whereis_binary($real_name, $root))) {
+ log::l("program not found: $real_name");
+ return;
+ }
+
if (my $pid = fork()) {
if ($options->{detach}) {
$pid;
@@ -104,8 +109,6 @@ sub raw {
log::l($_[0]);
c::_exit(128);
}
- my $binary = ref $name ? $name->[0] : $name;
- die_exit "program not found: $binary" if !find { -x $_ } $binary, map { "$_/$binary" } split(':', $ENV{PATH});
if ($stderr && $stderr eq 'STDERR') {
} elsif ($stderr) {
$stderr_mode =~ s/2//;
@@ -157,3 +160,8 @@ sub DESTROY {
}
1;
+
+#- Local Variables:
+#- mode:cperl
+#- tab-width:8
+#- End: