From ca648ff27ce1624b15ce42af57e6b8916dc3add0 Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Thu, 17 Sep 2020 15:09:18 -0700 Subject: [PATCH] Enable issue-url feature in color-eyre (#1072) * Enable issue-url feature in color-eyre * get version automatically * and the url! --- Cargo.lock | 63 ++++++++++++++++++++++++++++++++-- zebrad/Cargo.toml | 3 +- zebrad/src/application.rs | 6 +++- zebrad/src/components/tokio.rs | 1 + 4 files changed, 69 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a5eb7a0d9..1f5c03adc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -468,9 +468,9 @@ dependencies = [ [[package]] name = "color-eyre" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ac5c105065fcb0c002304ae32147ba52df86e07cea7de11c88c62d24972d683" +checksum = "22ba9b5e817f1bc1f2219b5a3474b69f838321b2a2ba8860d6a71c3bfe3d0fc1" dependencies = [ "backtrace", "color-spantrace", @@ -479,6 +479,7 @@ dependencies = [ "once_cell", "owo-colors", "tracing-error", + "url", ] [[package]] @@ -1183,6 +1184,17 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +[[package]] +name = "idna" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "im" version = "15.0.0" @@ -1363,6 +1375,12 @@ dependencies = [ "regex-automata", ] +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" + [[package]] name = "maybe-uninit" version = "2.0.0" @@ -1743,6 +1761,12 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + [[package]] name = "pin-project" version = "0.4.23" @@ -2618,6 +2642,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "tinyvec" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "238ce071d267c5710f9d31451efec16c5ee22de34df17cc05e56cbc92e967117" + [[package]] name = "tokio" version = "0.2.22" @@ -2999,6 +3029,24 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "unicode-bidi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +dependencies = [ + "matches", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-segmentation" version = "1.6.0" @@ -3023,6 +3071,17 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +[[package]] +name = "url" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" +dependencies = [ + "idna", + "matches", + "percent-encoding", +] + [[package]] name = "vec_map" version = "0.8.2" diff --git a/zebrad/Cargo.toml b/zebrad/Cargo.toml index 5877d0c7a..5dcd49e89 100644 --- a/zebrad/Cargo.toml +++ b/zebrad/Cargo.toml @@ -4,6 +4,7 @@ authors = ["Zcash Foundation "] license = "MIT OR Apache-2.0" version = "3.0.0-alpha.0" edition = "2018" +repository = "https://github.com/ZcashFoundation/zebra" [dependencies] zebra-chain = { path = "../zebra-chain" } @@ -24,7 +25,7 @@ futures = "0.3" tokio = { version = "0.2.22", features = ["time", "rt-threaded", "stream", "macros", "tracing", "signal"] } tower = "0.3" -color-eyre = "0.5" +color-eyre = { version = "0.5.4", features = ["issue-url"] } thiserror = "1" tracing = "0.1" tracing-futures = "0.2" diff --git a/zebrad/src/application.rs b/zebrad/src/application.rs index 9e13d2c09..e810d62b2 100644 --- a/zebrad/src/application.rs +++ b/zebrad/src/application.rs @@ -89,7 +89,11 @@ impl Application for ZebradApp { let terminal = Terminal::new(self.term_colors(command)); // This MUST happen after `Terminal::new` to ensure our preferred panic // handler is the last one installed - color_eyre::install().unwrap(); + color_eyre::config::HookBuilder::default() + .issue_url(concat!(env!("CARGO_PKG_REPOSITORY"), "/issues/new")) + .add_issue_metadata("version", env!("CARGO_PKG_VERSION")) + .install() + .unwrap(); Ok(vec![Box::new(terminal)]) } diff --git a/zebrad/src/components/tokio.rs b/zebrad/src/components/tokio.rs index 2affbf509..386c0bf22 100644 --- a/zebrad/src/components/tokio.rs +++ b/zebrad/src/components/tokio.rs @@ -71,6 +71,7 @@ mod imp { }; } + #[instrument] async fn sig(kind: SignalKind, name: &'static str) { // Create a Future that completes the first // time the process receives 'sig'.