Skip to content

Commit

Permalink
Merge pull request #51 from cakebaker/w_fix_never_used_warnings_on_wi…
Browse files Browse the repository at this point in the history
…ndows

w: disable functions unused on Windows
  • Loading branch information
sylvestre authored Apr 2, 2024
2 parents 94c8f17 + 9d82058 commit 1c5b20a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/uu/w/src/w.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -24,6 +27,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 +45,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 1c5b20a

Please sign in to comment.