I'd like to have something like this:
In setup code:
fn main() {
// stand-in for real isolation, could set up seccomp, fork off and re-exec ourselves again using e.g. https://github.com/containers/bubblewrap or systemd-run or whatever
procspawn::init_config("isolated", || libc::setuid(1000));
// This is the default config
procspawn::init();
Then, in the client code we can conveniently dispatch into these distinct process configurations:
// A task we want to be isolated; e.g. fetch a URL via HTTP, or perform some computation, or whatever
procspawn::spawn_config("isolated", || reqwest::get("https://example.com"));
// A task which runs with default process privileges
procspawn::spawn(|| std::fs::write("/etc/someconfig.conf", "somevalue"));
I'd like to have something like this:
In setup code:
Then, in the client code we can conveniently dispatch into these distinct process configurations: