oursh 0.4.4

Modern, fast POSIX compatible shell
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::ffi::CString;
use nix::sys::wait::WaitStatus;
use crate::{
    program::posix::builtin::Builtin,
    program::{Result, Runtime, parse_and_run},
};

/// Command builtin, I have no idea why you'd want this honestly.
pub struct Command;

impl Builtin for Command {
    fn run(self, argv: Vec<CString>, runtime: &mut Runtime) -> Result<WaitStatus> {
        let text = argv[1..].iter().map(|c| {
            c.to_str().unwrap()
        }).collect::<Vec<_>>().join(" ");
        parse_and_run(&text, runtime)
    }
}