in reply to Re^2: Killing subprocess in windows
in thread Killing subprocess in windows

> You can also use Win32::Process to create and kill the subprocess.
That a very good idea, thanks! :)

In case it's of use, some sample code I wrote years ago to cleanly kill processes after a timeout period:

BTW, I never use fork/exec on Windows, due to limitations and general weirdness of perlfork emulation under Windows.

Replies are listed 'Best First'.
Re^4: Killing subprocess in windows
by karlgoethebier (Abbot) on May 21, 2021 at 11:20 UTC

    Yes, i know you don’t want to spawn…

    But consider something like this:

    use strict; use warnings; use threads; use MCE::Hobo; my $hobo = MCE::Hobo->create( sub { …; }); my $pid = $hobo->pid(); # $hobo->join();

    Update:

    «I though about sending a 'kill', but Perl doesn't seem to give me the PID.»

    Now you have one to kill.

    «The Crux of the Biscuit is the Apostrophe»

Re^4: Killing subprocess in windows
by LanX (Saint) on May 20, 2021 at 23:50 UTC