Pdetached
Bun

property

Spawn.BaseOptions.detached

detached?: boolean

Run the child in a separate process group, detached from the parent.

  • POSIX: calls setsid() so the child starts a new session and becomes the process group leader. It can outlive the parent and receive signals independently of the parent’s terminal/process group.
  • Windows: sets UV_PROCESS_DETACHED, allowing the child to outlive the parent and receive signals independently.

Note: stdio may keep the parent process alive. Pass stdio: ["ignore", "ignore", "ignore"] to the spawn constructor to prevent this.