In my Vala app, I’m starting a child program (wget command) asynchronously with GLib.Process.spawn_async(…) function. It works fine and it sends back the process id (thanks to “out child_pid” parameter in the function call). Later in my app (at user request), I want to be able to kill that process with Process.close_pid (child_pid);
Important : I build and run my app within Flatpak environment (this is the origine of my current issue)
What happens :
- the child program is launched and it runs fine (I can see its process with ps command on the host and I can see that process with a host PID (like 28042 for example). I don’t see any process with “flatpak ps” command => it’s running at host level, not at flatpak level
- but the child_pid that is returned by spawn_async function is a pid inside the flatpak environment (like 13 for example), not the pid at host level. And by consequence, when I do a Process.close_pid(child_pid) it doesn’t close the child program process.
Do you know a way to get the pid inside the host environment instead of inside the flatpak environment ? Or is there a way for spawn_async() function to start the program inside the flatpak environment ?
Thanks in advance