Skip to content

Commit 3bd9cb0

Browse files
authored
fix(768): proper handling of possible stdin in logs stream (#769)
That was wrong assumption about "unreachable" code. StdIn still may occur, but we don't need this and explicitly pass only stderr & stdout flags. So for now it's simple filtering. Closes #768
1 parent 8962ef9 commit 3bd9cb0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

testcontainers/src/core/client.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,13 @@ where
482482
{
483483
fn from(stream: BS) -> Self {
484484
let stream = stream
485-
.map_ok(|chunk| match chunk {
486-
LogOutput::StdErr { message } => LogFrame::StdErr(message),
487-
LogOutput::StdOut { message } => LogFrame::StdOut(message),
488-
LogOutput::StdIn { .. } | LogOutput::Console { .. } => {
489-
unreachable!("only stdout and stderr are supported")
485+
.try_filter_map(|chunk| async {
486+
match chunk {
487+
LogOutput::StdErr { message } => Ok(Some(LogFrame::StdErr(message))),
488+
LogOutput::StdOut { message } => Ok(Some(LogFrame::StdOut(message))),
489+
// We only interested in stdout and stderr. Docker may return stdin in some
490+
// cases, but we don't need it as we have only one-way communication.
491+
LogOutput::StdIn { .. } | LogOutput::Console { .. } => Ok(None),
490492
}
491493
})
492494
.map_err(|err| match err {

0 commit comments

Comments
 (0)