diff --git a/src/uu/last/src/platform/macos.rs b/src/uu/last/src/platform/macos.rs new file mode 100644 index 00000000..d0c2dc85 --- /dev/null +++ b/src/uu/last/src/platform/macos.rs @@ -0,0 +1,17 @@ +// This file is part of the uutils util-linux package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. + +// Specific implementation for OpenBSD: tool unsupported (utmpx not supported) + +use crate::uu_app; + +use uucore::error::UResult; + +pub fn uumain(args: impl uucore::Args) -> UResult<()> { + let _matches = uu_app().try_get_matches_from(args)?; + + println!("unsupported command on macOS"); + Ok(()) +} diff --git a/src/uu/last/src/platform/mod.rs b/src/uu/last/src/platform/mod.rs index b3b1aa6c..73deaaf6 100644 --- a/src/uu/last/src/platform/mod.rs +++ b/src/uu/last/src/platform/mod.rs @@ -3,9 +3,9 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -#[cfg(unix)] +#[cfg(all(unix, not(target_os = "macos")))] mod unix; -#[cfg(unix)] +#[cfg(all(unix, not(target_os = "macos")))] pub use self::unix::*; #[cfg(target_os = "openbsd")] @@ -17,3 +17,8 @@ pub use self::openbsd::*; mod windows; #[cfg(windows)] pub use self::windows::*; + +#[cfg(target_os = "macos")] +mod macos; +#[cfg(target_os = "macos")] +pub use self::macos::*; diff --git a/src/uu/last/src/platform/unix.rs b/src/uu/last/src/platform/unix.rs index d8f3f2c8..8241770d 100644 --- a/src/uu/last/src/platform/unix.rs +++ b/src/uu/last/src/platform/unix.rs @@ -369,7 +369,7 @@ impl Last { .unwrap_or_else(|| time::OffsetDateTime::from_unix_timestamp(0).unwrap()); let time_delta = duration_string(calculate_time_delta(&curr_datetime, &shutdown)); if ut.is_user_process() { - proc_status = Some("- down"); + proc_status = Some("- down "); } ( self.end_time_string(proc_status, &shutdown), @@ -520,16 +520,18 @@ impl Last { write!(buf, " {host_to_print:<16}").unwrap_or_default(); } - let time_size = 3 + 2 + 2 + 1 + 2; - if self.host_last && !self.no_host && self.time_format != "notime" { - write!(buf, " {time: = result.stdout_str().lines().take(3).collect(); + + assert_eq!(output_expected, output_result); +} diff --git a/tests/fixtures/last/last.input.1 b/tests/fixtures/last/last.input.1 new file mode 100644 index 00000000..2d7e211f Binary files /dev/null and b/tests/fixtures/last/last.input.1 differ