Crates.io | tokio-process-bits |
lib.rs | tokio-process-bits |
version | 0.1.4 |
source | src |
created_at | 2017-12-26 20:09:09.496259 |
updated_at | 2017-12-29 15:24:32.229947 |
description | A collection of modules useful when developing Tokio based applications that spawn child processes. |
homepage | https://github.com/algermissen/tokio-bits |
repository | https://github.com/algermissen/tokio-bits |
max_upload_size | |
id | 44481 |
size | 15,592 |
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.