[fpc-pascal] CrossPlatform problem, INFINITE not defined on Linux
Marco van de Voort
fpc at pascalprogramming.org
Sun Jul 19 20:47:14 CEST 2020
Op 7/19/2020 om 5:40 PM schreef Bo Berglund via fpc-pascal:
> On Sun, 19 Jul 2020 08:46:14 +0200 (CEST), Michael Van Canneyt
> <michael at freepascal.org> wrote:
>
>> Various RunCommand procedures in process unit:
>> https://www.freepascal.org/docs-html/current/fcl/process/runcommand.html
>>
> But it looks like it hangs around until the started process exits...
> How can I set a timeout on the execution (don't want the whole system
> to hang if this external program does not exit)?
Runcommand handles the most used scenarios only. But in FPC 3.2.0 there
have been some changes to make own variants easier.
I happened to make a variant with a timeout last week, and use this as a
demonstration for that (3.2.0+) functionality :
https://forum.lazarus.freepascal.org/index.php/topic,50525.msg368880.html#msg368880
but that is as of yet still untested on non-windows. (but it is general
in principle)
I'll answer these because they are not documented yet:
poRunIdle - mainly for tprocess.runcommandloop: run a sleep() in the
main loop that polls the pipes.
In general, enable it for runcommands that run
longer (to reduce CPU use), disable it if you expect that the process
runs very short (e.g. "hostname" on linux)
poDetached - The Windows implementation of poNoconsole of FPC 3.0.4 and
older. FPC 3.2.0+ ponoconsole is instantiates less of the console, but
this causes problems for a few programs (like mysql console). In those
cases use podetached instead ponoconsole
More information about the fpc-pascal
mailing list