Wait for import-environment to finish

This commit is contained in:
Ivan Molodetskikh
2023-08-27 11:26:47 +04:00
parent b1791a7b38
commit f0611cd502
+16 -2
View File
@@ -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.