Skip to content

Commit

Permalink
w: disable functions unused on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
cakebaker committed Apr 2, 2024
1 parent 57a13ca commit f96bd7e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/uu/w/src/w.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.

use chrono::{self, Datelike};
#[cfg(not(windows))]
use chrono::Datelike;
use chrono::{self};
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};
Expand All @@ -24,6 +28,7 @@ struct UserInfo {
command: String,
}

#[cfg(not(windows))]
fn format_time(time: String) -> Result<String, chrono::format::ParseError> {
let mut t: String = time;
// Trim the seconds off of timezone offset, as chrono can't parse the time with it present
Expand All @@ -41,6 +46,7 @@ fn format_time(time: String) -> Result<String, chrono::format::ParseError> {
}
}

#[cfg(not(windows))]
fn fetch_cmdline(pid: i32) -> Result<String, std::io::Error> {
let cmdline_path = Path::new("/proc").join(pid.to_string()).join("cmdline");
fs::read_to_string(cmdline_path)
Expand Down

0 comments on commit f96bd7e

Please sign in to comment.