gag

Crates.iogag
lib.rsgag
version1.0.0
sourcesrc
created_at2015-04-01 17:52:26.349407
updated_at2021-05-30 17:18:57.458276
descriptionGag, redirect, or hold stdout/stderr output. Currently only *nix operating systems are supported.
homepage
repositoryhttps://github.com/Stebalien/gag-rs
max_upload_size
id1757
size14,709
Steven Allen (Stebalien)

documentation

https://docs.rs/gag/

README

Redirect and/or gag stdout/stderr.

Build Status

Documentation (with examples): https://docs.rs/gag/

Limitations

  • Won't work if something else has called std::io::set_print (currently unstable). Unfortunately, this function doesn't actually redirect the stdio file descriptor, it just replaces the std::io::stdout writer.
  • Won't work in rust test cases. The rust test cases use std::io::set_print to redirect stdout. You can get around this though by using the --nocapture argument when running your tests.

TODO:

  • General:
    • Better error handling?
  • Redirect:
    • Be generic over references. That is, accept both a reference to an AsRawFd or an AsRawFd. Unfortunately, I don't know if this is even possible. Borrow doesn't work because I really want the following constraint: impl<F> Redirect<F> where F: BorrowMut<T>, T: AsMut<AsRawFd> so I can write file.borrow_mut().as_mut() but that would be ambiguous...
  • Buffer:
    • Deallocate the buffer as it is read (FALLOC_FL_PUNCH_HOLE) if possible.
Commit count: 59

cargo fmt