From 2c58505f6b50c5a89e8fbb8dcf22d678826d1694 Mon Sep 17 00:00:00 2001 From: Ben Beasley Date: Sat, 31 Jan 2026 02:15:05 +0000 Subject: chore(deps): update whoami dependency to v2 (#3118) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the [2.0.0](https://github.com/ardaku/whoami/releases/tag/v2.0.0) series, `whoami` removed all infallible function variants, and removed the `fallible` module, moving those functions to the root module. Therefore, I replaced `whoami::fallible::hostname` with `whoami::hostname` (the same function with the same signature, just moved to the root module). For `whoami::username`, the infallible function that `atuin` was using before is gone, and we must add error handling. I chose to fall back to the string `"unknown-user"` if getting the username fails, just as `"unknown-host"` is already the fallback when getting the hostname fails. This seemed reasonable to me, but it’s worth double-checking if there could be any unintended consequences, especially if `unknown-user` happens to be a real, valid username on the system. The alternatives I can see would be to panic on failure or to amend the signature of `get_username()` and all of its call sites with some kind of more graceful error handling (what?). ## Checks - [x] I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle - [x] I have checked that there are no existing pull requests for the same thing --- crates/atuin-client/src/utils.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates') diff --git a/crates/atuin-client/src/utils.rs b/crates/atuin-client/src/utils.rs index a7c6eab0..35d7db26 100644 --- a/crates/atuin-client/src/utils.rs +++ b/crates/atuin-client/src/utils.rs @@ -1,11 +1,11 @@ pub(crate) fn get_hostname() -> String { - std::env::var("ATUIN_HOST_NAME").unwrap_or_else(|_| { - whoami::fallible::hostname().unwrap_or_else(|_| "unknown-host".to_string()) - }) + std::env::var("ATUIN_HOST_NAME") + .unwrap_or_else(|_| whoami::hostname().unwrap_or_else(|_| "unknown-host".to_string())) } pub(crate) fn get_username() -> String { - std::env::var("ATUIN_HOST_USER").unwrap_or_else(|_| whoami::username()) + std::env::var("ATUIN_HOST_USER") + .unwrap_or_else(|_| whoami::username().unwrap_or_else(|_| "unknown-user".to_string())) } /// Returns a pair of the hostname and username, separated by a colon. -- cgit v1.3.1