From f0611cd502c2e3f9b3eba200251202f7497f21a8 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sun, 27 Aug 2023 11:26:47 +0400 Subject: Wait for import-environment to finish --- src/niri.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/niri.rs b/src/niri.rs index a7dbfb54..9b6e3a17 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -166,8 +166,22 @@ impl Niri { dbus-update-activation-environment WAYLAND_DISPLAY", ]) .spawn(); - if let Err(err) = rv { - warn!("error spawning shell to import environment into systemd: {err:?}"); + // Wait for the import process to complete, otherwise services will start too fast + // without environment variables available. + match rv { + Ok(mut child) => match child.wait() { + Ok(status) => { + if !status.success() { + warn!("import environment shell exited with {status}"); + } + } + Err(err) => { + warn!("error waiting for import environment shell: {err:?}"); + } + }, + Err(err) => { + warn!("error spawning shell to import environment into systemd: {err:?}"); + } } // Set up zbus, make sure it happens before anything might want it. -- cgit