Red Hat Bugzilla – Bug 620083
whiptail --gauge does not work as advertised
Last modified: 2010-08-06 08:24:14 EDT
According to the whiptail manpage:
--gauge text height width percent
A gauge box displays a meter along the bottom of the box. The
meter indicates a percentage. New percentages are read from
standard input, one integer per line. The meter is updated to
reflect each new percentage. If stdin is XXX, then subsequent
lines up to another XXX are used for a new prompt. The gauge
exits when EOF is reached on stdin.
Running the following snippet does not change the text:
echo Replacement text
) | whiptail --gauge "Original text" 10 40 0
# whiptail --version
whiptail (newt): 0.52.1
Created attachment 435793 [details]
Simple patch to make the existing code work
Looking at the code, I think the authors intent was for the first line after XXX to be the new percentage. So the input would be of the form:
We're now at 30 percent complete.
I've attached a patch that makes it behave that way.
Created attachment 435794 [details]
Patch so behavior matches man page
The code as it exists does not match the behavior described in the man page.
My interpretation is that the input between XXX is just the text. The input stream would be:
We're now at 20 percent complete.
This attached patch implements that behaviors.
Thanks for the patches. We are trying to be compatible with dialog, so the first one is actually correct.
I've pushed an updated patch (to 0.52.11) to the newt git repository and a man page description fix, so it's clear that after XXX should be a percentage.
This will be in newt-0.52.12.
sleep 5 | whiptail --gauge "multi\nline" 10 40 0
while dialog displays:
With no leading space before line.
Should be fixed in git now. Thanks.