fail on socket error per default
Some checks are pending
continuous-integration/drone/push Build is passing
Some checks are pending
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3b4f13aa44
commit
22dd07cc14
@ -18,6 +18,7 @@ use std::io::{BufRead, BufReader, Error, ErrorKind, Result};
|
||||
use std::net::{IpAddr, SocketAddr};
|
||||
use std::os::unix::net::UnixStream;
|
||||
use std::path::PathBuf;
|
||||
use std::process::exit;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use structopt::StructOpt;
|
||||
@ -242,6 +243,9 @@ fn main() {
|
||||
Ok(state) => state,
|
||||
Err(err) => {
|
||||
eprintln!("Failed to read from socket: {}", err);
|
||||
if !opts.ignore_socket_errors {
|
||||
exit(1);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
@ -28,6 +28,9 @@ pub struct Opts {
|
||||
)]
|
||||
pub events: Option<PathBuf>,
|
||||
|
||||
#[structopt(short = "I", long = "ignore-socket-err", env = "WG_IGNORE_SOCKET_ERR")]
|
||||
pub ignore_socket_errors: bool,
|
||||
|
||||
#[structopt(name = "SOCKET", parse(from_os_str), env = "WG_EVENT_SOCKET")]
|
||||
pub socket: PathBuf,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user