Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
tokatoka committed Jan 20, 2025
1 parent ef57eb7 commit 7616540
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions libafl/src/observers/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,22 +225,25 @@ pub type StdOutObserver = StreamObserver<StdOutMarker>;
/// An observer that captures stderr of a target.
pub type StdErrObserver = StreamObserver<StdErrMarker>;

// Extension traits for specific stream types
/// Extension traits for stdout stream
pub trait HasStdOut {
/// React to stdout
fn observe_stdout(&mut self, stdout: &[u8]);
}

/// Extension traits for stderr stream
pub trait HasStdErr {
/// React to stderr
fn observe_stderr(&mut self, stderr: &[u8]);
}

impl HasStdOut for StreamObserver<StdOut> {
impl HasStdOut for StreamObserver<StdOutMarker> {
fn observe_stdout(&mut self, stdout: &[u8]) {
self.observe(stdout);
}
}

impl HasStdErr for StreamObserver<StdErr> {
impl HasStdErr for StreamObserver<StdErrMarker> {
fn observe_stderr(&mut self, stderr: &[u8]) {
self.observe(stderr);
}
Expand Down

0 comments on commit 7616540

Please sign in to comment.