1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use ;
/// Checks the status of host url from a GET request
///
/// # Arguments
/// * `host` - the full URL to check -> eg.. `"http://localhost:3000"`
///
/// # Returns
/// * `Ok(StatusCode)` if the request was successfully sent, containing the resulting status code
/// * `Err` if the request fails to *send*. This is not reflective of the status code
///
/// 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