kill_port

Function kill_port 

Source
pub fn kill_port(port_num: u16) -> Result<(), Box<dyn Error>>
Expand description

Kills any process listening to a provided port number

§Platform

This function only works on Unix based systems

§Arguments

  • port_num - the TCP port number to search for and terminate

§Returns

  • Ok(()) if processes were successfully terminated -> even if none were found
  • Err if lsof or kill fails, or if output cannot be parsed properly