aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-08-27 11:26:47 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-08-27 11:26:47 +0400
commitf0611cd502c2e3f9b3eba200251202f7497f21a8 (patch)
tree08d0654ed4e97db1accc68e2870c11e531ab96b9
parentb1791a7b387adee604707a532a7251c54825ce65 (diff)
downloadniri-f0611cd502c2e3f9b3eba200251202f7497f21a8.tar.gz
niri-f0611cd502c2e3f9b3eba200251202f7497f21a8.tar.bz2
niri-f0611cd502c2e3f9b3eba200251202f7497f21a8.zip
Wait for import-environment to finish
-rw-r--r--src/niri.rs18
1 files changed, 16 insertions, 2 deletions
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.