in reply to killing pp exe on windows leaves child running?
Use Win32::Process::Info to figure out the parent pid and if parent is alive
Also raise this issue with rt://PAR-Packer, Win32::Job can be used to make sure if parent is killed all spawned children are killed
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: killing pp exe on windows leaves child running? ( patch PAR-Packer-1.049\myldr\boot.c )
by Anonymous Monk on Sep 01, 2019 at 07:43 UTC | |
For C-level Win32::Job improvement (missing parts) That would go inside PAR-Packer-1.049\myldr\boot.c and maybe PAR-Packer-1.049\myldr\main.c around "SPAWN" With help from Re: Read STDOUT from Win32::Job while process is running, Re^5: Read STDOUT from Win32::Job while process is running, https://stackoverflow.com/questions/24012773/c-winapi-how-to-kill-child-processes-when-the-calling-parent-process-is-for A patch It compiles with some c/c++ warnings and what knot It doesnt add tests for this specific feature The existing test suite is failing a few tests ; not sure if related to my patch (my machine is slow)
I tested it, a.exe spawns a.exe, first a.exe is killed, second a.exe doesnt kill itself I've no time to debug further, probably fudged something from https://stackoverflow.com/questions/24012773/c-winapi-how-to-kill-child-processes-when-the-calling-parent-process-is-for
| [reply] [d/l] [select] |
by Anonymous Monk on Sep 01, 2019 at 23:23 UTC | |
Hmm, I think its not working cause it uses rc = spawnvp(P_WAIT, my_perl, (char* const*)argv); which ends up being from perl\win32\win32.c which ends up using CREATE_NEW_PROCESS_GROUP; So what needs done is copy/modify win32_spawnvp() or use CreateProcess directly ... to add JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE Too much blind experimenting for me at the moment Simply copy/pasting do_spawnvp_handle doesnt compile :/ | [reply] [d/l] [select] |
by Anonymous Monk on Sep 02, 2019 at 02:10 UTC | |
Simply copy/pasting do_spawnvp_handle doesnt compile :/ Yup, I dont know enough C to make this part happen | [reply] |