#child #child-process #stdout #module #tokio #developing #collection

tokio-process-bits

A collection of modules useful when developing Tokio based applications that spawn child processes

4 releases

Uses old Rust 2015

0.1.4 Dec 29, 2017
0.1.3 Dec 29, 2017
0.1.2 Dec 29, 2017
0.1.0 Dec 26, 2017

#38 in #child

Apache-2.0

7KB

tokio-process-bits

Exploring tokio-process async pipes io

This example shows how to read child processes stdout as streams of lines in an async fashion.

Running the example will produce something like this:

$ cargo run --example simple

LINE: [CHILD 88187] PING 127.0.0.1 (127.0.0.1): 56 data bytes
LINE: [CHILD 88187] 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.123 ms
LINE: [CHILD 88187] 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.110 ms
LINE: [CHILD 88188] PING 0.0.0.0 (0.0.0.0): 56 data bytes
LINE: [CHILD 88188] Request timeout for icmp_seq 0
LINE: [CHILD 88188] Request timeout for icmp_seq 1
LINE: [CHILD 88187] 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.113 ms

I mostly built this to explore async reading of child stdout so I can run such child processes from single-threaded Web services. That is: I want to serve Web requets while reading child stdout.


lib.rs:

This crate is a collection of modules useful for working with Tokio when spawning off child processes.

Dependencies

~6.5MB
~99K SLoC