Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use whoami::fallible::hostname() instead of env variable for hostname
Summary: I tested the `util::sys::hostname()` it return null on both linux and macOS. The test results are in D66772175 test plan. In the past we moved from `whoami::devicename()` to reading hostname from env var. But it has the risk that envvar yields empty string. As it was suggested on D56724499, I try using `whoami::fallible::hostname()` which is the new version of deprecated `whoami::hostname`. see suggestion in: https://www.internalfb.com/code/fbsource/[78677baeea59]/third-party/rust/vendor/whoami-1.5.2/src/api.rs?lines=88-95 `whoami::fallible::hostname()` returns `Result<String>` Then it should be safe. It catches and handles the errors. Reviewed By: muirdm Differential Revision: D66781930 fbshipit-source-id: 36f6a139110fd6c8136a719f15d92617f0858927
- Loading branch information