Skip to content

Commit

Permalink
fix: always install error hook first (#6150)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Oct 27, 2023
1 parent ce1b943 commit 4422d67
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/cast/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ use opts::{Opts, Subcommands, ToBaseArgs};

#[tokio::main]
async fn main() -> Result<()> {
utils::load_dotenv();
handler::install()?;
utils::load_dotenv();
utils::subscriber();
utils::enable_paint();

Expand Down
9 changes: 7 additions & 2 deletions crates/config/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use crate::Config;
use alloy_primitives::U256;
use eyre::WrapErr;
use figment::value::Value;
use foundry_compilers::{
remappings::{Remapping, RemappingError},
Expand Down Expand Up @@ -33,10 +34,14 @@ pub fn load_config_with_root(root: Option<PathBuf>) -> Config {
/// Returns the path of the top-level directory of the working git tree. If there is no working
/// tree, an error is returned.
pub fn find_git_root_path(relative_to: impl AsRef<Path>) -> eyre::Result<PathBuf> {
let path = relative_to.as_ref();
let path = std::process::Command::new("git")
.args(["rev-parse", "--show-toplevel"])
.current_dir(relative_to.as_ref())
.output()?
.current_dir(path)
.output()
.wrap_err_with(|| {
format!("Failed detect git root path in current dir: {}", path.display())
})?
.stdout;
let path = std::str::from_utf8(&path)?.trim_end_matches('\n');
Ok(PathBuf::from(path))
Expand Down
2 changes: 1 addition & 1 deletion crates/forge/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use cmd::{cache::CacheSubcommands, generate::GenerateSubcommands, watch};
use opts::{Opts, Subcommands};

fn main() -> Result<()> {
utils::load_dotenv();
handler::install()?;
utils::load_dotenv();
utils::subscriber();
utils::enable_paint();

Expand Down

0 comments on commit 4422d67

Please sign in to comment.