Skip to content

Commit

Permalink
Fixing relative path resolving when running frusing cargo bench
Browse files Browse the repository at this point in the history
  • Loading branch information
bazhenov committed Apr 21, 2024
1 parent 50a0e3b commit aca676e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tango-bench/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use colorz::mode::{self, Mode};
use core::fmt;
use glob_match::glob_match;
use std::{
env::args,
env::{self, args},
fmt::Display,
io::{stderr, Write},
num::NonZeroUsize,
Expand Down Expand Up @@ -190,9 +190,15 @@ pub fn run(mut settings: MeasurementSettings) -> Result<ExitCode> {
Box::<ConsoleReporter>::default()
};

let path = path
let mut path = path
.or_else(|| args().next().map(PathBuf::from))
.expect("No path given");
if path.is_relative() {
// Resolving paths relative to PWD if given
if let Ok(pwd) = env::var("PWD") {
path = PathBuf::from(pwd).join(path)
}
};

#[cfg(target_os = "linux")]
let path = crate::linux::patch_pie_binary_if_needed(&path)?.unwrap_or(path);
Expand Down

0 comments on commit aca676e

Please sign in to comment.