Drain stdout through closure in the PTY attachment test (#63894)

The exit status can arrive before the PTY reader delivers its final bytes.
Drain stdout to channel closure while awaiting the exit status so the test
compares complete output with and without file descriptor attachments.

GitOrigin-RevId: c695a1c1cd00c11071bd17523cfc2ca7effc697c
This commit is contained in:
Dylan Hurd
2026-11-25 12:04:48 +00:00
committed by copyberry
parent 077eab36fd
commit 6cb4fd1d2d
+2 -3
View File
@@ -1358,10 +1358,9 @@ async fn pty_attachments_preserve_shell_environment_and_signal_status() -> anyho
unsafe { libc::fcntl(reader.as_raw_fd(), libc::F_GETFD) },
flags
);
let (_session, output_rx, exit_rx) = combine_spawned_output(spawned);
let (bytes, status) =
collect_output_until_exit(output_rx, exit_rx, /*timeout_ms*/ 2_000).await;
assert_eq!(status, expected_status);
tokio::join!(collect_split_output(spawned.stdout_rx), spawned.exit_rx);
assert_eq!(status?, expected_status);
output.push(bytes);
}
assert!(!output[0].is_empty());