Front page | perl.perl6.users |
Postings from March 2023
Re: my zenity adventure
Thread Previous
From:
ToddAndMargo via perl6-users
Date:
March 27, 2023 17:29
Subject:
Re: my zenity adventure
Message ID:
413b3a34-e08d-aa18-a132-6d10ac5b0f8e@zoho.com
> On 27 March 2023 01:35:39 CEST, ToddAndMargo via perl6-users
> <perl6-users@perl.org> wrote:
>
> Hi All,
>
> Fedora 36
> zenity-3.43.0-3.fc37.x86_64
> rakudo-pkg-2022.7.0-03.x86_64
>
>
> My adventure with a zenity call!
>
> I just worked around a problem with a call to zenity:
>
> Note: zenity can not resolve Raku's "\n", so you have to
> preformat the "text" field with "sprintf".
>
>
> $NotifyStr = sprintf "\nStarting $ProgramName\n\nTakes about $Timeout seconds to finish compiling\nMozilla Mirror = <$MozillaMirror>\n";
>
> The above gave me "All updates are complete" in the text
> field. Hmmmmmmmm. I do goof a lot of stuff up (who me????)
> but I am "pretty sure" I did not tell zenity that.
> I did a direct print of $NotifyStr to the command
> line to make sure anyway.
>
>
> I traced it down to the "<" and ">".
>
> Separating the "<" and ">" with `~ ">" ~` in the string
> did not help.
>
>
> Taking out the "<" and ">" got rid of the problem. Not
> as pretty, but it will due.
>
> $NotifyStr = sprintf "\nStarting $ProgramName\n\nTakes about $Timeout seconds to finish compiling\nMozilla Mirror = $MozillaMirror\n";
>
>
> The zenity call:
>
> shell "zenity --info --title \"$Title\" --text \"$NotifyStr\" --width=220 --timeout=$Timeout &";
>
>
> I was unable to reproduce this from a direct call
> to zenity from the command line, so it was probably
> something that happened between Raku and zenity.
>
> Of interest, on the direct call "\n" came out as an "S".
>
>
> Hope this helps someone else.
>
> On 3/26/23 22:53, Timo Paulssen via perl6-users wrote:
>> Hey Todd,
>>
>> Its likely that because you are using the shell sub the < and >
>> characters have been interpreted by the shell to mean redirection. Check
>> for odd files in your working directory that have the text you saw
>> zenity output in them, and perhaps there is even a file with heat the
>> capital letter S.
>>
>> When you are putting together strings like that to put into a shell
>> call, you are dancing on very thin ice wearing Doc Martens and a
>> backpack filled to point of bursting with tungsten bars while balancing
>> buckets of boiling water on the tip of your nose and also for some
>> reason there are sharks below the ice ...
>>
>> Also, sprintf should pass \n through as-is Anne it likely got
>> interpreted later on by some other part of the process.
>>
>> Be extremely weary of your variables containing double quotes in them,
>> and slightly weary of single quotes.
>>
>> Hope that helps you find out what exactly is going on
>>
I figured! Thank you!
Hmmm, "All updates complete" sound like it may have came from
# dnf updates
Thread Previous