Don't use yes command sub-process
authorJamie Cameron <jcameron@webmin.com>
Wed, 30 Apr 2008 20:55:44 +0000 (20:55 +0000)
committerJamie Cameron <jcameron@webmin.com>
Wed, 30 Apr 2008 20:55:44 +0000 (20:55 +0000)
software/apt-lib.pl
software/debian-lib.pl

index ab60271..da99aea 100644 (file)
@@ -18,7 +18,13 @@ print "<b>",&text('apt_install', "<tt>$cmd</tt>"),"</b><p>\n";
 print "<pre>";
 $update = join(" ", map { quotemeta($_) } split(/\s+/, $update));
 &additional_log('exec', undef, $cmd);
-&open_execute_command(CMD, "yes Yes | $cmd 2>&1", 1);
+local $yesfile = &transname();
+&open_tempfile(YESFILE, ">$yesfile", 0, 1);
+foreach (0..100) {
+       &print_tempfile(YESFILE, "Yes\n");
+       }
+&close_tempfile(YESFILE);
+&open_execute_command(CMD, "$cmd 2>&1 <$yesfile", 1);
 while(<CMD>) {
        if (/setting\s+up\s+(\S+)/i && !/as\s+MDA/i) {
                push(@rv, $1);
index 1c7948d..466b307 100644 (file)
@@ -10,7 +10,7 @@ local $arg = @_ ? join(" ", map { quotemeta($_) } @_) : "";
 &open_execute_command(PKGINFO, "COLUMNS=200 dpkg --list $arg", 1, 1);
 while(<PKGINFO>) {
        next if (/^\|/ || /^\+/);
-       if (/^[ri]i..(\S+)\s+(\S+)\s+(.*)/) {
+       if (/^[uirph]i..(\S+)\s+(\S+)\s+(.*)/) {
                $packages{$i,'name'} = $1;
                $packages{$i,'class'} = &alphabet_name($1);
                $packages{$i,'version'} = $2;