checkAfterResume function

Future<ProcessCheck> checkAfterResume(
  1. int pid, {
  2. Duration within = const Duration(seconds: 3),
})

pid's check once it is no longer stopped, polled for up to within; the stopped check when it stays so.

Implementation

Future<ProcessCheck> checkAfterResume(int pid, {Duration within = const Duration(seconds: 3)}) async {
  final deadline = DateTime.now().add(within);
  var check = await checkProcess(pid);
  while (check.life == ProcessLife.stopped && DateTime.now().isBefore(deadline)) {
    await Future<void>.delayed(const Duration(milliseconds: 400));
    check = await checkProcess(pid);
  }
  return check;
}