fn kill(sh: &ServiceHandler, signal: Option<signal::Signal>) {
    let signal = signal.unwrap_or_else(|| sh.service().termination.signal.into());
    debug!("Going to send {} signal to pid {:?}", signal, sh.pid());
    if let Some(pid) = sh.pid() {
        if let Err(error) = signal::kill(pid, signal) {
            match error {
                // No process or process group can be found corresponding to that specified by pid
                // It has exited already, so it's fine.
                nix::errno::Errno::ESRCH => (),
                _ => error!(
                    "Error killing the process: {}, service: {}, pid: {:?}",
                    error,
                    sh.name(),
                    pid,
                ),
            }
        }
    } else {
        warn!(
            "{}: Missing pid to kill but service was in {:?} state.",
            sh.name(),
            sh.status
        );
    }
}
/// A Kill wrapper which will send a signal to sh.
/// It will send the signal set out in the termination section of the service
A Kill wrapper which will send a signal to sh.
It will send the signal set out in the termination section of the service
A Kill wrapper which will send a signal to sh . It will send the signal set out in the termination section of the service
fn kill(sh: &ServiceHandler, signal: Option<signal::Signal>) {
    let signal = signal.unwrap_or_else(|| sh.service().termination.signal.into());
    debug!("Going to send {} signal to pid {:?}", signal, sh.pid());
    if let Some(pid) = sh.pid() {
        if let Err(error) = signal::kill(pid, signal) {
            match error {
                // No process or process group can be found corresponding to that specified by pid
                // It has exited already, so it's fine.
                nix::errno::Errno::ESRCH => (),
                _ => error!(
                    "Error killing the process: {}, service: {}, pid: {:?}",
                    error,
                    sh.name(),
                    pid,
                ),
            }
        }
    } else {
        warn!(
            "{}: Missing pid to kill but service was in {:?} state.",
            sh.name(),
            sh.status
        );
    }
}
fn kill ( sh : & ServiceHandler , signal : Option < signal :: Signal > ) { let signal = signal . unwrap_or_else ( | | sh . service ( ) . termination . signal . into ( ) ) ; debug ! ( " " signal sh pid ( ) ) ; if let Some ( pid ) = sh . pid ( ) { if let Err ( error ) = signal :: kill ( pid , signal ) { match error { // No process or process group can be found corresponding to that specified by pid // It has exited already, so it's fine. nix :: errno :: Errno :: ESRCH => ( ) , _ => error ! ( " " error sh name ( ) pid ) , } } } else { warn ! ( " " sh name ( ) sh status ) ; } }
A Kill wrapper which will send a signal to sh.
A Kill wrapper which will send a signal to sh .
sh
&ServiceHandler
signal
Option<signal::Signal>
sh
&ServiceHandler
signal
Option<signal::Signal>