#log #pipe #stdout #stderr


Provide multiple file descriptors writing into one in-order pipe, tagged by the source of data (e.g. stdout/stderr)

7 releases (stable)

1.4.0 Nov 15, 2020
1.3.0 Aug 22, 2020
1.1.0 Jul 27, 2020
1.0.1 Feb 7, 2020
0.1.1 Feb 5, 2020

#393 in Command-line interface

Download history 24/week @ 2023-02-07 41/week @ 2023-02-14 24/week @ 2023-02-21 9/week @ 2023-02-28 14/week @ 2023-03-07 12/week @ 2023-03-14 38/week @ 2023-03-21 20/week @ 2023-03-28 22/week @ 2023-04-04 28/week @ 2023-04-11 4/week @ 2023-04-18 26/week @ 2023-04-25 24/week @ 2023-05-02 33/week @ 2023-05-09 20/week @ 2023-05-16 13/week @ 2023-05-23

98 downloads per month
Used in 2 crates


265 lines


A Mux provides a single receive end and multiple send ends. Data sent to any of the send ends comes out the receive end, in order, tagged by the sender.

Each send end works as a file descriptor. For instance, with io-mux you can collect stdout and stderr from a process, and highlight any error output from stderr, while preserving the relative order of data across both stdout and stderr.



If you enable the async feature, io-mux additionally provides an AsyncMux type, which allows processing data asynchronously.

You may want to use this with async-process or async-pidfd to concurrently wait on the exit of a process and the muxed output and error of that process. Until the process exits, call AsyncMux::read() to get the next bit of output, awaiting that concurrently with the exit of the process. Once the process exits and will thus produce no further output, call AsyncMux::read_nonblock until it returns None to drain the remaining output out of the mux.


io-mux uses UNIX sockets, so it only runs on UNIX platforms. Support for non-Linux platforms is experimental, and has a major caveat in its semantics; please see the documentation for more details.


~89K SLoC