caffeinateArguments function

List<String> caffeinateArguments(
  1. PowerAssertionOptions options, {
  2. required int pid,
})

The caffeinate(8) argument vector for options, ending in the -w <pid> lifecycle bind: caffeinate watches the fa pid and self-exits when it goes away, so a crashed fa can never leak the assertion.

Implementation

List<String> caffeinateArguments(
  PowerAssertionOptions options, {
  required int pid,
}) => [
  if (options.idle) '-i',
  if (options.display) '-d',
  if (options.system) '-s',
  if (options.user) '-u',
  '-w',
  '$pid',
];