killGracefully method

Future<int> killGracefully(
  1. Process process, {
  2. bool debugLogging = false,
})

Implementation

Future<int> killGracefully(
  Process process, {
  bool debugLogging = false,
}) async {
  final processId = process.pid;
  if (debugLogging) {
    print('Sending SIGTERM to $processId..');
  }
  await cancelAllStreamSubscriptions();
  Process.killPid(processId);
  return process.exitCode.timeout(
    killTimeout,
    onTimeout: () => killForcefully(process, debugLogging: debugLogging),
  );
}