Create detached command from terminal

Hi there!

I'm currently stuck with a little problem: I'd like to spawn a shell command that doesn't exit when the parent process or the terminal it lives in ends.

Example:

fn main() { Command::new("external-command").spawn().unwrap(); }

This works fine, BUT it creates a zombie process. Because we're not .waiting on the subcommand, it will live as a zombie process when the parent exits.

How can I avoid this problem and just run a detached command, just like you would do a external-command & in bash?

Thanks for your help!