Updated init command

This commit is contained in:
Jan-Bulthuis 2025-02-21 20:46:10 +01:00
parent 4b264c5da8
commit d94aa35576
3 changed files with 11 additions and 6 deletions

View File

@ -52,7 +52,7 @@ pub fn gather_sessions(user: &User) -> Vec<Session> {
true => gather_hm_sessions(&hm_profile),
false => vec![Session {
name: String::from("Shell"),
init: user.shell.clone(),
init: user.shell.to_str().unwrap().to_owned(),
}],
}
}
@ -105,7 +105,11 @@ fn gather_session_data(path: &PathBuf) -> Session {
let session_path = path.join("session");
let name = read_to_string(session_path.join("name")).unwrap();
let init = session_path.join("init");
let init = format!(
"{} && {}",
path.join("activate").display(),
session_path.join("init").display()
);
Session { name, init }
}

View File

@ -30,7 +30,7 @@ pub fn login(
return Ok(LoginResult::Success);
} else {
starting = true;
let cmd = vec![session.init.to_str().unwrap().to_owned()];
let cmd = vec![session.init.clone()];
let env = vec![];
Request::StartSession { cmd, env }.write_to(&mut stream)?;
}

View File

@ -111,7 +111,7 @@ impl Display for User {
#[derive(PartialEq, Eq, Clone)]
struct Session {
name: String,
init: PathBuf,
init: String,
}
impl Display for Session {
@ -325,11 +325,12 @@ impl App {
{
LoginResult::Success => {
self.error = false;
self.status = Status::Success
self.status = Status::Success;
self.exit = true;
}
LoginResult::Failure => {
self.error = true;
self.status = Status::Error
self.status = Status::Error;
}
};
}