xonecas.io
8447
Co

conveyor / commit a09c781

Platform-neutral process checks and widget library extension

Co-Authored-By: Claude Opus 5.5

sacenox2026-11-12 a09c7810fbd82a93c554408e6618995a62467580 parent 13a6f38

3 files changed

crates/conveyor-app/src/reload.rs+3−3
@@ -1,4 +1,4 @@
1-//! Loads the widget library's latest build into this process: libconveyor_widgets.so, next to
1+//! Loads the widget library's latest build into this process: libconveyor_widgets (.so or .dylib), next to
22 //! the binary. Old builds stay mapped, since their threads may still be winding down. A build
33 //! made against another build of this app waits for the app's own restart.
44 use crate::api::{Abouts, Kinds};
@@ -19,7 +19,7 @@ pub struct Loader {
1919 impl Loader {
2020 pub fn new() -> Self {
2121 let dir = std::env::current_exe().ok().and_then(|e| Some(e.parent()?.to_owned())).unwrap_or_default();
22- Loader { file: dir.join("libconveyor_widgets.so"), loaded: None, count: 0 }
22+ Loader { file: dir.join(format!("libconveyor_widgets.{}", std::env::consts::DLL_EXTENSION)), loaded: None, count: 0 }
2323 }
2424
2525 /// The widgets of a build not loaded yet, when there is one this app can run.
@@ -29,7 +29,7 @@ impl Loader {
2929 self.count += 1;
3030 // dlopen keys on the path: each build gets its own.
3131 let dir = std::env::var("XDG_RUNTIME_DIR").map_or(std::env::temp_dir(), PathBuf::from);
32- let copy = dir.join(format!("conveyor-widgets-{}-{}.so", std::process::id(), self.count));
32+ let copy = dir.join(format!("conveyor-widgets-{}-{}.{}", std::process::id(), self.count, std::env::consts::DLL_EXTENSION));
3333 std::fs::copy(&self.file, &copy).ok()?;
3434 let loaded = unsafe { open(&copy) };
3535 let _ = std::fs::remove_file(&copy);
crates/conveyor/src/vm.rs+2−2
@@ -81,8 +81,8 @@ impl Drop for Vm {
8181 pub fn reap(name: &str) {
8282 if let Ok(pid) = fs::read_to_string(paths::vm_sock(name, "pid")) {
8383 // Only the QEMU running this VM: the pid file can outlive it, and its pid be reused.
84- let (cmd, arg) = (fs::read(format!("/proc/{}/cmdline", pid.trim())).unwrap_or_default(), format!("-name\0{name}\0"));
85- if cmd.windows(arg.len()).any(|w| w == arg.as_bytes()) {
84+ let cmd = run(Command::new("ps").args(["-p", pid.trim(), "-o", "command="])).unwrap_or_default();
85+ if cmd.contains(&format!("-name {name} ")) {
8686 let _ = Command::new("kill").arg(pid.trim()).status();
8787 std::thread::sleep(Duration::from_secs(1));
8888 }
tools/bake.py+1−1
@@ -184,7 +184,7 @@ def poweroff(name, secs=120):
184184 end = time.monotonic() + secs
185185 while pid_file.exists() and time.monotonic() < end:
186186 pid = int(pid_file.read_text() or 0)
187- if not pid or not Path(f"/proc/{pid}").exists():
187+ if not pid or subprocess.call(["kill", "-0", str(pid)], stderr=subprocess.DEVNULL):
188188 break
189189 time.sleep(1)
190190 else: