chore: move sigsegv handler to reth-cli-util crate (#9421)

This commit is contained in:
Tuan Tran
2024-07-10 23:50:22 +07:00
committed by GitHub
parent a29d8bdbdf
commit 94f4066478
7 changed files with 18 additions and 14 deletions

1
Cargo.lock generated
View File

@ -6674,6 +6674,7 @@ dependencies = [
"alloy-eips",
"alloy-primitives",
"eyre",
"libc",
"proptest",
"rand 0.8.5",
"reth-fs-util",

View File

@ -181,18 +181,6 @@ pub mod rpc {
#[doc(inline)]
pub use reth_cli_runner::{tokio_runtime, CliContext, CliRunner};
#[cfg(all(unix, any(target_env = "gnu", target_os = "macos")))]
pub mod sigsegv_handler;
/// Signal handler to extract a backtrace from stack overflow.
///
/// This is a no-op because this platform doesn't support our signal handler's requirements.
#[cfg(not(all(unix, any(target_env = "gnu", target_os = "macos"))))]
pub mod sigsegv_handler {
/// No-op function.
pub fn install() {}
}
#[cfg(all(feature = "jemalloc", unix))]
use tikv_jemallocator as _;

View File

@ -13,7 +13,7 @@ fn main() {
use reth::cli::Cli;
use reth_node_ethereum::EthereumNode;
reth::sigsegv_handler::install();
reth_cli_util::sigsegv_handler::install();
// Enable backtraces unless a RUST_BACKTRACE value has already been explicitly provided.
if std::env::var_os("RUST_BACKTRACE").is_none() {

View File

@ -15,7 +15,7 @@ compile_error!("Cannot build the `op-reth` binary with the `optimism` feature fl
#[cfg(feature = "optimism")]
fn main() {
reth::sigsegv_handler::install();
reth_cli_util::sigsegv_handler::install();
// Enable backtraces unless a RUST_BACKTRACE value has already been explicitly provided.
if std::env::var_os("RUST_BACKTRACE").is_none() {

View File

@ -27,3 +27,6 @@ eyre.workspace = true
[dev-dependencies]
proptest.workspace = true
[target.'cfg(unix)'.dependencies]
libc = "0.2"

View File

@ -15,3 +15,15 @@ pub use load_secret_key::get_secret_key;
/// Cli parsers functions.
pub mod parsers;
pub use parsers::{hash_or_num_value_parser, parse_duration_from_secs, parse_socket_address};
#[cfg(all(unix, any(target_env = "gnu", target_os = "macos")))]
pub mod sigsegv_handler;
/// Signal handler to extract a backtrace from stack overflow.
///
/// This is a no-op because this platform doesn't support our signal handler's requirements.
#[cfg(not(all(unix, any(target_env = "gnu", target_os = "macos"))))]
pub mod sigsegv_handler {
/// No-op function.
pub fn install() {}
}