mirror of
https://github.com/atuinsh/atuin.git
synced 2025-02-10 07:30:06 +01:00
fix(tz): attempt to fix timezone reading (#1810)
This commit is contained in:
parent
f9fa441d60
commit
3d6b163546
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user