You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
582 B
26 lines
582 B
4 years ago
|
use super::*;
|
||
|
use std::marker::PhantomData;
|
||
|
|
||
|
#[derive(Debug)]
|
||
|
pub(crate) struct GetStderr<S: Shell, E: Expression<S>> {
|
||
|
_s: PhantomData<S>,
|
||
|
expr: E,
|
||
|
}
|
||
|
|
||
|
impl<S: Shell, E: Expression<S>> GetStderr<S, E> {
|
||
|
pub(crate) fn new(expr: E) -> Self {
|
||
|
Self {
|
||
|
_s: PhantomData,
|
||
|
expr,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl<S: Shell, E: Expression<S>> Expression<S> for GetStderr<S, E> {
|
||
|
fn write_shell(&self, writer: &mut impl std::fmt::Write) -> std::fmt::Result {
|
||
|
self.expr.write_shell(writer)?;
|
||
|
write!(writer, " 2>&1")?;
|
||
|
Ok(())
|
||
|
}
|
||
|
}
|