Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isolate external Command #49

Open
timglabisch opened this issue Aug 23, 2018 · 0 comments
Open

Isolate external Command #49

timglabisch opened this issue Aug 23, 2018 · 0 comments

Comments

@timglabisch
Copy link

Hello,

i am wondering if it is possible to isolate an external command using gaol.

i tryed something like this:

fn handle_child()
{
    let cmd = env::args().skip(2).next().expect("cmd ...");
    let args = env::args().skip(3).map(|v| v.to_string()).collect::<Vec<_>>();

    println!("??? {}, {:?}", &cmd, &args);

    ChildSandbox::new( profile()).activate().unwrap();

    ::std::process::Command::new(&cmd)
        .args(&args)
        .stdin(Stdio::inherit())
        .stdout(Stdio::inherit())
        .spawn()
        .expect("command failed")
    ;
}

fn main() {

    if env::args().skip(1).next().is_some() && env::args().skip(1).next().expect("...") == "child" {
        return handle_child();
    }

    println!("???");

    let sandbox = Sandbox::new( profile());

    let args = env::args().skip(2).map(|v| v.to_string()).collect::<Vec<_>>();

    let res = sandbox.start(
        Command::me().unwrap()
            .arg("child")
            .arg("/usr/bin/true")
           // .args(&args)
    ).unwrap().wait();

}

i don't want to give the child the ability to run ::std::process::Command::new(&cmd).

thanks for any kind of help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant