Skip to content

Commit 9a089c8

Browse files
committed
HACK: fail test, debuggging
1 parent d535824 commit 9a089c8

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/uu/who/src/platform/unix.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ fn current_tty() -> String {
187187
impl Who {
188188
#[allow(clippy::cognitive_complexity)]
189189
fn exec(&mut self) -> UResult<()> {
190+
println!("Who::exec");
190191
let run_level_chk = |_record: i16| {
191192
#[cfg(not(target_os = "linux"))]
192193
return false;
@@ -201,13 +202,15 @@ impl Who {
201202
utmpx::DEFAULT_FILE
202203
};
203204
if self.short_list {
205+
println!("Who::short");
204206
let users = Utmpx::iter_all_records_from(f)
205207
.filter(Utmpx::is_user_process)
206208
.map(|ut| ut.user())
207209
.collect::<Vec<_>>();
208210
println!("{}", users.join(" "));
209211
println!("{}", translate!("who-user-count", "count" => users.len()));
210212
} else {
213+
println!("Who::!short");
211214
let records = Utmpx::iter_all_records_from(f);
212215

213216
if self.include_heading {
@@ -220,14 +223,18 @@ impl Who {
220223
};
221224

222225
for ut in records {
226+
println!("Who::records");
227+
223228
if !self.my_line_only || cur_tty == ut.tty_device() {
229+
println!("Who::!my || tty");
224230
if self.need_users && ut.is_user_process() {
225231
self.print_user(&ut)?;
226232
} else if self.need_runlevel && run_level_chk(ut.record_type()) {
227233
if cfg!(target_os = "linux") {
228234
self.print_runlevel(&ut);
229235
}
230236
} else if self.need_boottime && ut.record_type() == utmpx::BOOT_TIME {
237+
println!("boottime");
231238
self.print_boottime(&ut);
232239
} else if self.need_clockchange && ut.record_type() == utmpx::NEW_TIME {
233240
self.print_clockchange(&ut);

tests/by-util/test_who.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ fn test_count() {
3535
fn test_boot() {
3636
let ts = TestScenario::new(util_name!());
3737
for opt in ["-b", "--boot", "--b"] {
38-
let expected_stdout = unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str();
38+
let expected_stdout =
39+
unwrap_or_return!(expected_result(&ts, &[opt])).stdout_move_str() + "hello";
3940
ts.ucmd().arg(opt).succeeds().stdout_is(expected_stdout);
4041
}
4142
}

0 commit comments

Comments
 (0)