Elektrobit / flake-pilot

Registration/Control utility for applications launched through a runtime-engine, e.g containers
MIT License
9 stars 5 forks source link

Extract common code #156

Closed Ichmed closed 11 months ago

Ichmed commented 11 months ago

Create a User struct and move the

let mut command = Command::new("sudo");
if let Some(user) = user {
        command.arg("--user").arg(user);
}
command.arg(<program>);

pattern there.

Now you can write

let mut command = user.run(<program>);

This is only a small first step, we should think about moving other structs and functions (like chmod) into the common lib. Especially the config structs so flake-ctl and the pilots can share them.

Ichmed commented 11 months ago

The Test runs fine on my machine, trying to reproduce, maybe #155 will help

Ichmed commented 11 months ago

Forgot to flatten the User struct into the config