Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
set panic = "abort"
Browse files Browse the repository at this point in the history
  • Loading branch information
ordian committed Feb 20, 2019
1 parent 127140e commit 3866c81
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ name = "parity"
[profile.release]
debug = false
lto = true
panic = "abort"

[workspace]
# This should only list projects that are not
Expand Down
2 changes: 1 addition & 1 deletion accounts/ethstore/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl fmt::Display for Error {
}

fn main() {
panic_hook::set_abort();
panic_hook::set();
if env::var("RUST_LOG").is_err() {
env::set_var("RUST_LOG", "warn")
}
Expand Down
2 changes: 1 addition & 1 deletion evmbin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Display result state dump in standardized JSON format.
"#;

fn main() {
panic_hook::set_abort();
panic_hook::set();
env_logger::init();

let args: Args = Docopt::new(USAGE).and_then(|d| d.deserialize()).unwrap_or_else(|e| e.exit());
Expand Down
2 changes: 1 addition & 1 deletion parity/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ macro_rules! trace_main {
}

fn main() {
panic_hook::set_abort();
panic_hook::set();

// the user has specified to run its originally installed binary (not via `parity-updater`)
let force_direct = std::env::args().any(|arg| arg == "--force-direct");
Expand Down
8 changes: 4 additions & 4 deletions util/panic-hook/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ extern crate backtrace;
use std::io::{self, Write};
use std::panic::{self, PanicInfo};
use std::thread;
use std::process;
use backtrace::Backtrace;

/// Set the panic hook to write to stderr and abort the process when a panic happens.
pub fn set_abort() {
/// Set the panic hook to write a backtrace to stderr when a panic happens.
pub fn set() {
set_with(|msg| {
let _ = io::stderr().write_all(msg.as_bytes());
process::abort()
// uncomment if panic != "abort"
// std::process::abort()
});
}

Expand Down
2 changes: 1 addition & 1 deletion whisper/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ impl fmt::Display for Error {
}

fn main() {
panic_hook::set_abort();
panic_hook::set();

match execute(env::args()) {
Ok(_) => {
Expand Down

0 comments on commit 3866c81

Please sign in to comment.