Lazarus + "rsync -a ... ..." copy is timing out. How to fix?

32 Views Asked by At

Lazarus 2.x, linux-Mint+Cinnamon 21.2.

I am using runCommand('rsync -a Src Dst); to backup some files and it is working fine until it gets to a big (1-GB or so) then it times out after about 10-20-seconds (guessed). I then get the "taking too long, Force Stop or Wait" OS-dialog.

I have done some searching and found a few suggestions, one was to add compression ("-az") but I need the destination copies as-is. I also found "--timeout=SECONDS" and set that to 3600 as nothing is ever likely to take more than about 10-minutes. But that is being ignored and still timing out anyway.

Clearly, the "-z" option does something other than just compress,so how can I put a hold on that timeout?

Tried the above and was expecting it to honor the "--timeout=3600" or something else to overcome the issue.

EDIT: if I click the "Wait" option it also completes OK with no further timeouts.

1

There are 1 best solutions below

0
Marco van de Voort On

Probably the message comes because the runcommand has its own loop but doesn't call the GUI mainloop, not draining messages which some part of the system sees and decides the GUI application is non responsive.

The easiest workaround is to simply run the command in a thread. Then the mainloop with gui remains responsive -> done.

Alternately, you could try to copy the runcommand code into your own program, and change it to an own TProcess derivative and set OnRunCommandEvent to a handler that calls the gui loop in an onidle. Requires some fiddling.

But IMHO the thread option is fastest and eaiest.