systemdInhibitArguments function
The systemd-inhibit(1) argument vector for options: systemd-inhibit
holds its --what capabilities while the COMMAND it runs stays alive,
so the argument vector ends in a watchdog shell loop that exits when
the fa pid disappears — the Linux counterpart of caffeinate -w.
Implementation
List<String> systemdInhibitArguments(
PowerAssertionOptions options, {
required int pid,
}) => [
'--what=${options.system ? 'idle:sleep' : 'idle'}',
'--who=fa',
'--why=${options.reason}',
'sh',
'-c',
'while kill -0 $pid 2>/dev/null; do sleep 10; done',
];