Skip to content

Commit

Permalink
w: disable utmpx on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
cakebaker committed Mar 30, 2024
1 parent 2505564 commit 9da9fc7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/uu/w/src/w.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand All @@ -22,6 +23,7 @@ struct UserInfo {
command: String,
}

#[cfg(not(windows))]
fn fetch_user_info() -> Result<Vec<UserInfo>, std::io::Error> {
let mut user_info_list = Vec::new();
for entry in Utmpx::iter_all_records() {
Expand All @@ -41,6 +43,12 @@ fn fetch_user_info() -> Result<Vec<UserInfo>, std::io::Error> {

Ok(user_info_list)
}

#[cfg(windows)]
fn fetch_user_info() -> Result<Vec<UserInfo>, 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)?;
Expand Down

0 comments on commit 9da9fc7

Please sign in to comment.