From:
[email protected]
tags 263270 + patch
thanks
Hello,
The patch below takes care of the defoma-hints problem. Whiptail/dialog
output their GUI to stdout, so the only way to prevent GUI from ending
up in the hints file is to redirect it to stderr. However stderr is used
by default to output the user's choice. The patch forces the user's choice output to go to fd 3 (using --output-fd 3 option to whiptail), which is
dup2'ed to the child's pipe end and gets returned to the parent, while
child's stout and stderr get discarded. With the patch it appears to work
as expected.
-----------------------------------cut here------------------------------
--- defoma-0.11.8_orig/libs/libconsole.pl 2004-01-01 13:47:02.000000000 -0500
+++ defoma-0.11.8/libs/libconsole.pl 2004-08-14 00:38:20.000000000 -0400
@@ -1,3 +1,5 @@
+use POSIX;
+
my $dialog = '/usr/bin/whiptail';
$dialog = '/usr/bin/dialog' unless (-x $dialog);
@@ -7,7 +9,8 @@
my $pid = fork();
if ($pid == 0) {
close(PARENT_READER);
- open(STDERR, ">&CHILD_WRITER");
+ dup2(fileno(CHILD_WRITER),3);
+ open(STDOUT, ">&STDERR");
exec(@_);
die("exec failure: $_[0]");
}
@@ -83,7 +86,7 @@
# my $item=$output;
# chomp $item; # For gdialog, which returns strings with newlines.
- my $item = safe_redirect($dialog, '--clear', '--title',
+ my $item = safe_redirect($dialog, '--output-fd', '3', '--clear', '--title',
$title, @options, $type, $text, $height, 80, @vars);
$result = ($result >> 8);
-----------------------------------cut here------------------------------
Best regards,
Jurij Smakov
[email protected]
K