Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re^3: Killing subprocess in windows

by eyepopslikeamosquito (Bishop)
on May 20, 2021 at 23:35 UTC ( #11132818=note: print w/replies, xml ) Need Help??

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();


    «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 (Sage) on May 20, 2021 at 23:50 UTC

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11132818]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2021-10-26 23:36 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (91 votes). Check out past polls.