~goorzhel/radm

08bf2e3cafa59628d8e00d17a638d22d3b3059cc — Antonio Gurgel 3 months ago e1299bf
Use session's name for log files rather than rstdm
1 files changed, 9 insertions(+), 5 deletions(-)

M src/user.rs
M src/user.rs => src/user.rs +9 -5
@@ 82,9 82,13 @@ impl User {
        Ok(BaseDirectories::new()?)
    }

    /// Opens handles on `$XDG_STATE_HOME/rstdm-std{out,err}`, for capturing output from the [session
    /// Opens handles on `$XDG_STATE_HOME/${SESSION_NAME}-std{out,err}`, for capturing output from the [session
    /// process](crate::session::Desktop::exec).
    pub fn get_standard_outputs(&self, xdg: &BaseDirectories) -> Result<(File, File)> {
    pub fn get_standard_outputs(
        &self,
        session_name: &str,
        xdg: &BaseDirectories,
    ) -> Result<(File, File)> {
        let path = xdg.get_state_home();

        let open = |file: &str| -> Result<File> {


@@ 103,8 107,8 @@ impl User {
            Ok(file)
        };

        let stdout = open("rstdm-stdout.log")?;
        let stderr = open("rstdm-stderr.log")?;
        let stdout = open(&format!("{}-stdout.log", session_name))?;
        let stderr = open(&format!("{}-stderr.log", session_name))?;
        Ok((stdout, stderr))
    }



@@ 116,7 120,7 @@ impl User {
        dbus: Dbus,
    ) -> Result<ExitStatus> {
        let (stdout, stderr) = self
            .get_standard_outputs(xdg)
            .get_standard_outputs(&session.name, xdg)
            .context("Failed to set up stdout/err")?;

        // TODO: This and the Desktop type assume that `Exec` has one and only one argument.