summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@elliehuxtable.com>2024-03-02 17:05:04 +0000
committerGitHub <noreply@github.com>2024-03-02 17:05:04 +0000
commit3d6b16354697e6036a57819d79f2f6084392938a (patch)
tree36fa6b4ca93d4245ac113abc024618252ac3a3ff
parentf9fa441d6089fd735a8a3a20f12ab00eb659f342 (diff)
fix(tz): attempt to fix timezone reading (#1810)
-rw-r--r--atuin-client/src/settings.rs6
-rw-r--r--atuin/src/command/client.rs7
2 files changed, 8 insertions, 5 deletions
diff --git a/atuin-client/src/settings.rs b/atuin-client/src/settings.rs
index a71091e2..3b34381c 100644
--- a/atuin-client/src/settings.rs
+++ b/atuin-client/src/settings.rs
@@ -151,7 +151,11 @@ impl FromStr for Timezone {
fn from_str(s: &str) -> Result<Self> {
// local timezone
if matches!(s.to_lowercase().as_str(), "l" | "local") {
- let offset = UtcOffset::current_local_offset()?;
+ // There have been some timezone issues, related to errors fetching it on some
+ // platforms
+ // Rather than fail to start, fallback to UTC. The user should still be able to specify
+ // their timezone manually in the config file.
+ let offset = UtcOffset::current_local_offset().unwrap_or(UtcOffset::UTC);
return Ok(Self(offset));
}
diff --git a/atuin/src/command/client.rs b/atuin/src/command/client.rs
index 6aacf422..ec2a03fb 100644
--- a/atuin/src/command/client.rs
+++ b/atuin/src/command/client.rs
@@ -74,14 +74,15 @@ impl Cmd {
.build()
.unwrap();
- let res = runtime.block_on(self.run_inner());
+ let settings = Settings::new().wrap_err("could not load client settings")?;
+ let res = runtime.block_on(self.run_inner(settings));
runtime.shutdown_timeout(std::time::Duration::from_millis(50));
res
}
- async fn run_inner(self) -> Result<()> {
+ async fn run_inner(self, mut settings: Settings) -> Result<()> {
Builder::new()
.filter_level(log::LevelFilter::Off)
.filter_module("sqlx_sqlite::regexp", log::LevelFilter::Off)
@@ -90,8 +91,6 @@ impl Cmd {
tracing::trace!(command = ?self, "client command");
- let mut settings = Settings::new().wrap_err("could not load client settings")?;
-
let db_path = PathBuf::from(settings.db_path.as_str());
let record_store_path = PathBuf::from(settings.record_store_path.as_str());