I've been working on something that can run a file with the default app for that file, so executing a .exe, but opening a .txt with notepad, for example.
I am currently using the crate 'opener'. It does what I want, but it just returns the result.
I want to also be able to kill the process later, how would I combine (std::Command::Child).kill with opener?
Or is there a better way?
It does not look like it is possible to get any information about the child process from the opener crate. There is a different crate called open which provides access to a std::process::Command: commands in open - Rust That can in turn be used to spawn and gain access to a Child handle.
And even if you could, you shouldn't use it, because depending on the platform (e.g. macOS), the file might be displayed by an existing process, so killing it would be harmful to the user's other work.