Browse Source

query: suppress broken pipe error

ipv6
Denis Drakhnia 1 year ago
parent
commit
ca2aef3326
  1. 1
      Cargo.lock
  2. 1
      query/Cargo.toml
  3. 5
      query/src/main.rs

1
Cargo.lock generated

@ -510,6 +510,7 @@ name = "xash3d-query" @@ -510,6 +510,7 @@ name = "xash3d-query"
version = "0.1.0"
dependencies = [
"getopts",
"libc",
"serde",
"serde_json",
"termion",

1
query/Cargo.toml

@ -11,6 +11,7 @@ default = ["color"] @@ -11,6 +11,7 @@ default = ["color"]
color = ["termion"]
[dependencies]
libc = "0.2.148"
thiserror = "1.0.49"
getopts = "0.2.21"
serde = { version = "1.0.188", features = ["derive"] }

5
query/src/main.rs

@ -558,6 +558,11 @@ fn execute(cli: Cli) -> Result<(), Error> { @@ -558,6 +558,11 @@ fn execute(cli: Cli) -> Result<(), Error> {
fn main() {
let cli = cli::parse();
// suppress broken pipe error
unsafe {
libc::signal(libc::SIGPIPE, libc::SIG_DFL);
}
if let Err(e) = execute(cli) {
eprintln!("error: {}", e);
process::exit(1);

Loading…
Cancel
Save