From 9d820584e6fd2f5af7edda78edbd81de6ea0ba15 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 2 Apr 2024 09:40:28 +0200 Subject: [PATCH] w: disable functions unused on Windows --- src/uu/w/src/w.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/uu/w/src/w.rs b/src/uu/w/src/w.rs index 5e8ad2b4..5b7df7b1 100644 --- a/src/uu/w/src/w.rs +++ b/src/uu/w/src/w.rs @@ -3,10 +3,13 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. +#[cfg(not(windows))] use chrono::{self, Datelike}; use clap::crate_version; use clap::{Arg, ArgAction, Command}; -use std::{fs, path::Path, process}; +use std::process; +#[cfg(not(windows))] +use std::{fs, path::Path}; #[cfg(not(windows))] use uucore::utmpx::Utmpx; use uucore::{error::UResult, format_usage, help_about, help_usage}; @@ -24,6 +27,7 @@ struct UserInfo { command: String, } +#[cfg(not(windows))] fn format_time(time: String) -> Result { let mut t: String = time; // Trim the seconds off of timezone offset, as chrono can't parse the time with it present @@ -41,6 +45,7 @@ fn format_time(time: String) -> Result { } } +#[cfg(not(windows))] fn fetch_cmdline(pid: i32) -> Result { let cmdline_path = Path::new("/proc").join(pid.to_string()).join("cmdline"); fs::read_to_string(cmdline_path)