From a2bf14804696e36eb6e185d32e689f59d1803c67 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Wed, 24 May 2023 16:08:37 +0200 Subject: [PATCH 1/4] chore: use --offline with vendored builds --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 898f4afd..76d3b4d4 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ endif VENDOR ?= 0 ifneq ($(VENDOR),0) - ARGS += --locked + ARGS += --offline --locked endif TARGET_BIN="$(DESTDIR)$(bindir)/$(BINARY)" From d9fee40124b54d27b12b0e9a5e3a0afc57bffbc8 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Wed, 24 May 2023 16:09:02 +0200 Subject: [PATCH 2/4] chore(deb): faster debian package builds It's not necessary to define CARGO_HOME. --- debian/rules | 3 --- 1 file changed, 3 deletions(-) diff --git a/debian/rules b/debian/rules index c8f4dd04..5a266947 100755 --- a/debian/rules +++ b/debian/rules @@ -15,9 +15,6 @@ ifeq ($(VENDOR),1) ischroot || make vendor endif -override_dh_auto_build: - CARGO_HOME="$$(pwd)/target/cargo" make - override_dh_installinit: dh_installinit -r From 70fbad69e63ff0bb25d9de99b27af4b307282ea0 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Wed, 24 May 2023 16:10:31 +0200 Subject: [PATCH 3/4] chore(deb): ignore vendor/ and target/ in source tar Results in faster and smaller source tarball creation if they exist --- debian/source/options | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 debian/source/options diff --git a/debian/source/options b/debian/source/options new file mode 100644 index 00000000..97d96f63 --- /dev/null +++ b/debian/source/options @@ -0,0 +1,2 @@ +tar-ignore=target +tar-ignore=vendor \ No newline at end of file From 9d0e1e88cea6bf9cbb59dd508d91e19014635ffa Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Wed, 24 May 2023 16:12:44 +0200 Subject: [PATCH 4/4] fix(input): zombie process from Action::Spawn Each invocation of `Action::Spawn` was spawning a process without waiting on the child; resulting in an accumulation of zombie sh processes. This will create background threads which waits on the child to ensure that they are reaped on exit. --- src/input/mod.rs | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/src/input/mod.rs b/src/input/mod.rs index 733fb479..4208fafc 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -1137,24 +1137,33 @@ impl State { workspace.toggle_floating_window(seat); } Action::Spawn(command) => { - if let Err(err) = std::process::Command::new("/bin/sh") - .arg("-c") - .arg(command.clone()) - .env("WAYLAND_DISPLAY", &self.common.socket) - .env( - "DISPLAY", - &self - .common - .xwayland_state - .as_ref() - .map(|s| format!(":{}", s.display)) - .unwrap_or(String::new()), - ) - .env_remove("COSMIC_SESSION_SOCK") - .spawn() - { - warn!(?err, "Failed to spawn \"{}\"", command); - } + let wayland_display = self.common.socket.clone(); + + let display = self + .common + .xwayland_state + .as_ref() + .map(|s| format!(":{}", s.display)) + .unwrap_or_default(); + + std::thread::spawn(move || { + let mut cmd = std::process::Command::new("/bin/sh"); + + cmd.arg("-c") + .arg(command.clone()) + .env("WAYLAND_DISPLAY", &wayland_display) + .env("DISPLAY", &display) + .env_remove("COSMIC_SESSION_SOCK"); + + match cmd.spawn() { + Ok(mut child) => { + let _res = child.wait(); + } + Err(err) => { + tracing::warn!(?err, "Failed to spawn \"{}\"", command); + } + } + }); } } }