sendSignal method

  1. @override
void sendSignal(
  1. String signal
)
override

Sends a POSIX signal name (e.g. SIGINT, SIGTERM) to the process.

Implementation

@override
void sendSignal(String signal) {
  // Interactive signals are delivered the terminal-native way: writing the
  // control character lets the pty line discipline raise the signal for the
  // foreground process group (honouring whatever mode the program set).
  final control = _controlChar(signal);
  if (control != null) {
    writeStdin([control]);
    return;
  }
  // Process-wide signals (TERM/KILL/HUP) go to `script`, which relays the
  // hangup to the child when its master closes.
  final sig = _processSignal(signal);
  if (sig != null) {
    try {
      _process.kill(sig);
    } on Object {
      // Ignore: child already gone.
    }
  }
}