From 9da9fc707437ba83f4ade6bc75c60e28a88aa316 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sat, 30 Mar 2024 16:06:05 +0100 Subject: [PATCH] w: disable utmpx on Windows --- src/uu/w/src/w.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/uu/w/src/w.rs b/src/uu/w/src/w.rs index c19df49..1b143d0 100644 --- a/src/uu/w/src/w.rs +++ b/src/uu/w/src/w.rs @@ -6,6 +6,7 @@ use clap::crate_version; use clap::{Arg, ArgAction, Command}; use std::process; +#[cfg(not(windows))] use uucore::utmpx::Utmpx; use uucore::{error::UResult, format_usage, help_about, help_usage}; @@ -22,6 +23,7 @@ struct UserInfo { command: String, } +#[cfg(not(windows))] fn fetch_user_info() -> Result, std::io::Error> { let mut user_info_list = Vec::new(); for entry in Utmpx::iter_all_records() { @@ -41,6 +43,12 @@ fn fetch_user_info() -> Result, std::io::Error> { Ok(user_info_list) } + +#[cfg(windows)] +fn fetch_user_info() -> Result, std::io::Error> { + Ok(Vec::new()) +} + #[uucore::main] pub fn uumain(args: impl uucore::Args) -> UResult<()> { let matches = uu_app().try_get_matches_from(args)?;