From efd2230eba28cea6265288315e80ca1be96783c2 Mon Sep 17 00:00:00 2001 From: Patrick Decat Date: Wed, 15 Mar 2023 00:15:39 +0100 Subject: Prefer PWD environment variable over cwd if available to better support symbolic links (#783) --- src/command/client/history.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/command/client/history.rs') diff --git a/src/command/client/history.rs b/src/command/client/history.rs index 7382eba6..8735123e 100644 --- a/src/command/client/history.rs +++ b/src/command/client/history.rs @@ -5,6 +5,7 @@ use std::{ time::Duration, }; +use atuin_common::utils; use clap::Subcommand; use eyre::Result; use runtime_format::{FormatKey, FormatKeyError, ParsedFmt}; @@ -181,8 +182,7 @@ impl Cmd { // It's better for atuin to silently fail here and attempt to // store whatever is ran, than to throw an error to the terminal - let cwd = env::current_dir() - .map_or_else(|_| String::new(), |dir| dir.display().to_string()); + let cwd = utils::get_current_dir(); let h = History::new(chrono::Utc::now(), command, cwd, -1, -1, None, None); @@ -240,7 +240,7 @@ impl Cmd { None }; let cwd = if *cwd { - Some(env::current_dir()?.display().to_string()) + Some(utils::get_current_dir()) } else { None }; -- cgit v1.3.1