Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/uu/users/src/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// spell-checker:ignore (paths) wtmp

use std::ffi::OsString;
use std::io::{Write, stdout};
use std::path::Path;

use clap::builder::ValueParser;
Expand Down Expand Up @@ -73,7 +74,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {

if !users.is_empty() {
users.sort();
println!("{}", users.join(" "));
writeln!(stdout().lock(), "{}", users.join(" "))?;
}

Ok(())
Expand Down
15 changes: 15 additions & 0 deletions tests/by-util/test_users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@ use uutests::new_ucmd;
#[cfg(any(target_vendor = "apple", target_os = "linux"))]
use uutests::{util::TestScenario, util_name};

#[ignore = "does not work as same as users > /dev/full"]
#[test]
#[cfg(target_os = "linux")]
fn test_full_panic() {
let full = std::fs::OpenOptions::new()
.write(true)
.open("/dev/full")
.unwrap();

new_ucmd!()
.set_stdout(full)
.fails()
.stderr_contains("No space");
}

#[test]
fn test_invalid_arg() {
new_ucmd!().arg("--definitely-invalid").fails_with_code(1);
Expand Down
Loading