PipeRead not working as expected?

This might be also FvwmScript related problem - I’m not sure.

I’ve made a simple weather applet which first gathers data from RSS/XML feed, parses it, resizes 6 icons and the displays them on my desktop. For some reason all the icons won’t show up every time. Here is the simplified version:

[code]Do { PipeRead “rm icon*.*”}

Do { PipeRead "resize…
Do { PipeRead "resize…
Do { PipeRead "resize…
Do { PipeRead "resize…
Do { PipeRead "resize…
Do { PipeRead "resize…

ChangeIcon 1 $Icon1
ChangeIcon 2 $Icon2
ChangeIcon 3 $Icon3
ChangeIcon 4 $Icon4
ChangeIcon 5 $Icon5
ChangeIcon 6 $Icon6
[/code]
I have no idea why this is not working every time. It really seems the ChangeIcon gets executed way before it really should. If I manually delete all the icons and restart, I see no icons. If I restart then immediately, I see the correct icons - most of the time. So even the “rm” portion is not executed correctly before applying the icons. Odd thing is that there is no error messages displayed in Ctrl-Alt-F1 console.

This is quite frustrating. What is the correct way to execute shell commands and wait for them to finish 100% before continuing. If I’m doing something wrong, what could it be?

Im using v2.5.12.

Well, I suppose it is 100% impossible to use PipeRead to wait for a shell command to end - at least if the shell command doesn’t output anything. I redesigned my applet to use PeriodicTasks to wait before continuing the process.

  1. I download the weather data. “Set $NewInfo=(Add (GetTime) 3)”. NewInfo defines the actual moment I can continue, 3 seconds later here.
  2. Wait for a 3 seconds.
  3. Parse the data and resize the images. “Set $NewImages=(Add (GetTime) 3)”. NewImages again specifies when it is safe to continue.
  4. Wait again 3 s.
  5. Display the icons.

This seems to work properly now. Of course this is quite ugly as I have to figure out the delays myself but at least it works.

What about using GetOutput ?

Thanks for the suggestion, but it also doesn’t seem to work as expected, or as I expect, at least. Odd things happen here too. The next code doesn’t work. $WeatherFile doesn’t get created.

Set $GatherDataCommand = {exec curl -s "http://... [SNIP] ... > $WeatherFile}
(GetOutput $GatherDataCommand 1 -1)

The next code DOES work. The only difference is a few totally irrelevant Set commands inserted. $WeatherFile is present after executing the script.

Set $GatherDataCommand = {exec curl -s "http://... [SNIP] ... > $WeatherFile}

Set $DownloadTime       = (GetTime)
Set $ParseTime          = 0
Set $DisplayTime        = 0

(GetOutput $GatherDataCommand 1 -1)

It would be nice to know if this is a user error, a feature, or a bug that can be possibly fixed some day. So far the only 100% working solution is to hardcode some delays like I described previously. The problem with delays is that they have to be “guessed”. Someone using slower computer than mine/having network delays/etc. might need to alter the delays.

I always presumed GetOuptput blocked, but I’m certainly not sure about it as I never used it to do really slow things, unless parsing the filenames of 3000+ songs counts as slow…