kill method

  1. @override
bool kill([
  1. ProcessSignal? signal
])

Kills the current running process.

Without signal, kills the command and all its descendants (children, grandchildren...): sigterm first, then sigkill for the ones still running after 5 seconds (in the background, the call returns at once). On Windows the whole tree is terminated at once (taskkill /t /f).

With signal, sends it to the command only, except ProcessSignal.sigkill which kills all its descendants too.

Returns true if the signal is successfully delivered to the process. Otherwise the signal could not be sent, usually meaning, that the process is already dead.

Implementation

@override
bool kill([ProcessSignal? signal]) {
  // Picked the current 'timestamp' of the run killed
  _killedRunId = _runId;
  _killedProcessSignal = signal;
  return _kill();
}