Luc <l...@sep.invalid> wrote:
> On Thu, 8 Feb 2024 19:17:34 -0000 (UTC), Rich wrote:
>
>>> That code doesn't work. No output. I only get output with my previous
>>> approach:
>>
>>That implies a delete and recreate approach (which is an odd way to
>>do it, but it /is/ a windows program, so....), which will be *much*
>>harder for you to keep up with.
>
> I was going to give up because it's just an experiment, but something
> odd is happening and I would like to understand it.
>
>
> set feedfile "/dev/shm/myfeed.txt"
> set fifofile "/dev/shm/myfeed.fifo"
> exec tail -f $feedfile > $fifofile &
If using tail to copy from the wine created 'feed' to the fifo works
(you say it does when you indicate you 'cat' the fifo below) then you
should just be able to open the feed file and read/gets from it.
> (build Tk GUI with text widget to display the data)
>
> while {[gets $fd line] > -1} {
> puts $line
> return
>
> (text widget insertion here, not in use yet, return aborts
> it)
> }
>
> I get no output. Nothing happens.
That while loop above only ever runs for one iteration because of the
'return'. I suspect you meant to use 'continue' not 'return'.
> Then I go to the directory where the fifo file is in a regular shell
> terminal:
>
> $ cat myfeed.fifo
>
> After running that command, I get all the output (ok, makes sense)
> but:
>
> 1. Only in the shell terminal, not in the IDE's compiler output pane
> which usually captures the output.
If the code you posted here is the same you are running in the IDE,
then only running the while for a singe gets/puts iteration is why.
> 2. AND the Tk GUI with the text widget shows up on the screen. Empty,
> but visible.
>
> Why?
Because the return terminates the while loop.
> Moreover, if I remove the 'return' line, then the IDE captures the
> output (because of the 'puts' line), but the Tk GUI never shows up.
>
> Again, why?
Because the while loop never lets the event loop run. With the event
loop paused no Tk GUI will ever show up.