process-iterator

Crates.ioprocess-iterator
lib.rsprocess-iterator
version0.2.0
sourcesrc
created_at2018-02-11 01:47:53.768584
updated_at2018-02-11 01:47:53.768584
descriptionUse an external process as an iterator (adaptor or consuer).
homepage
repositoryhttps://github.com/gregwebs/rust-process-iterator
max_upload_size
id50613
size16,477
Greg Weber (gregwebs)

documentation

README

rust-process-iterator

Stream data through an external process. The stdlib interfaces to running commands and those from other packages do not readily support streaming. This package fills the gap.

This package supplies 2 functions:

  • process_read_consumer
  • process_as_reader

process_read_consumer takes a Read as stdin and waits for the process to finish. process_as_reader gives back a Read of stdout

One difficult aspect of streaming is error handling. process_as_reader additionally gives back a future to check for errors

Things in this package should look somewhat familiar to the Child data type that is getting wrapped. Of notable addition is the Output type, in particular Output::ToFd which directs the command builder to direct output directly to a given file (which must have a valid descriptor).

Please look at the test suite for more example usage.

Development

You can encapsulate development of this library in a docker container. There is a ./bin/cargo script for invoking cargo in a container with the working directory mounted.

Commit count: 33

cargo fmt