[][src]Function shellfn_core::execute_iter_panic_panic

pub fn execute_iter_panic_panic<T, TArg, TEnvKey, TEnvVal>(
    cmd: impl AsRef<OsStr>,
    args: impl IntoIterator<Item = TArg>,
    envs: impl IntoIterator<Item = (TEnvKey, TEnvVal)>
) -> impl Iterator<Item = T> where
    T: FromStr,
    TArg: AsRef<OsStr>,
    TEnvKey: AsRef<OsStr>,
    TEnvVal: AsRef<OsStr>,
    <T as FromStr>::Err: StdError

Executes command with args and environment variables, parses output line by line

  • On invalid command: panic
  • On error exit code: break iterator
  • On parsing failure: panic
  • Possible errors: N/A

Designed for

use shellfn::shell;
use std::error::Error;

#[shell]
fn command() -> impl Iterator<Item = u32> {
    "echo 1; echo 2; echo 3"
}

assert_eq!(vec![1, 2, 3], command().collect::<Vec<_>>())