Fork Bomb #7

Closed
opened 2026-04-19 19:03:47 +00:00 by Quaternions · 1 comment

The application is spawning itself from command line, why? Just call an async function or spawn a new thread if you must.

umutray/src/tray.rs Lines 8 to 17 in 2f4f1c64d2
fn spawn_setup(name: &str) {
let exe = std::env::current_exe().unwrap_or_else(|_| PathBuf::from("umutray"));
if let Err(e) = std::process::Command::new(exe)
.arg("setup")
.arg(name)
.spawn()
{
eprintln!("umutray: failed to launch setup for {name}: {e}");
}
}

umutray/src/tray.rs Lines 19 to 24 in 2f4f1c64d2
fn spawn_gui() {
let exe = std::env::current_exe().unwrap_or_else(|_| PathBuf::from("umutray"));
if let Err(e) = std::process::Command::new(exe).arg("gui").spawn() {
eprintln!("umutray: failed to launch dashboard: {e}");
}
}

umutray/src/tray.rs Lines 26 to 30 in 2f4f1c64d2
fn spawn_setup_picker() {
let exe = std::env::current_exe().unwrap_or_else(|_| PathBuf::from("umutray"));
if let Err(e) = std::process::Command::new(exe).arg("setup").spawn() {
eprintln!("umutray: failed to launch setup picker: {e}");
}

The application is spawning itself from command line, why? Just call an async function or spawn a new thread if you must. https://git.aleshym.co/funman300/umutray/src/commit/2f4f1c64d2eea77a5a682675bc9794c24a0b4e38/src/tray.rs#L8-L17 https://git.aleshym.co/funman300/umutray/src/commit/2f4f1c64d2eea77a5a682675bc9794c24a0b4e38/src/tray.rs#L19-L24 https://git.aleshym.co/funman300/umutray/src/commit/2f4f1c64d2eea77a5a682675bc9794c24a0b4e38/src/tray.rs#L26-L30
Owner

Fixed. Replaced all std::process::Command::new(exe) self-spawning patterns with direct std::thread::spawn calls that invoke the actual functions:

tray.rs:

  • spawn_setup() now calls setup::run() in a thread instead of spawning umutray setup <name>
  • spawn_gui() now calls gui::run() in a thread instead of spawning umutray gui (which also eliminated a duplicate tray icon bug)
  • spawn_setup_picker() now calls setup::run_new() in a thread instead of spawning umutray setup

gui.rs:

  • Message::AddLauncher, Message::Setup, and Message::RerunSetup handlers all use thread::spawn with direct function calls instead of subprocess spawning

No more fork-bombing — the application stays as a single process.

🤖 This comment was posted by Claude Code (Anthropic AI).

Fixed. Replaced all `std::process::Command::new(exe)` self-spawning patterns with direct `std::thread::spawn` calls that invoke the actual functions: **`tray.rs`:** - `spawn_setup()` now calls `setup::run()` in a thread instead of spawning `umutray setup <name>` - `spawn_gui()` now calls `gui::run()` in a thread instead of spawning `umutray gui` (which also eliminated a duplicate tray icon bug) - `spawn_setup_picker()` now calls `setup::run_new()` in a thread instead of spawning `umutray setup` **`gui.rs`:** - `Message::AddLauncher`, `Message::Setup`, and `Message::RerunSetup` handlers all use `thread::spawn` with direct function calls instead of subprocess spawning No more fork-bombing — the application stays as a single process. 🤖 This comment was posted by [Claude Code](https://claude.ai/claude-code) (Anthropic AI).
Sign in to join this conversation.
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/umutray#7