Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2159 #2168

Merged
merged 1 commit into from
Apr 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::path::{Path, PathBuf};
use std::time::Instant;

use cli::{Cli, Command};
use errors::anyhow;
use utils::net::{get_available_port, port_is_available};

use clap::{CommandFactory, Parser};
Expand All @@ -13,10 +14,17 @@ mod messages;
mod prompt;

fn get_config_file_path(dir: &Path, config_path: &Path) -> (PathBuf, PathBuf) {
let root_dir = dir
.ancestors()
.find(|a| a.join(config_path).exists())
.unwrap_or_else(|| panic!("could not find directory containing config file"));
let root_dir = dir.ancestors().find(|a| a.join(config_path).exists()).unwrap_or_else(|| {
messages::unravel_errors(
"",
&anyhow!(
"{} not found in current directory or ancestors, current_dir is {}",
config_path.display(),
dir.display()
),
);
std::process::exit(1);
});

// if we got here we found root_dir so config file should exist so we can unwrap safely
let config_file = root_dir
Expand Down