Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Killing the child process is not working

by BrowserUk (Pope)
on Mar 20, 2013 at 07:29 UTC ( #1024459=note: print w/ replies, xml ) Need Help??


in reply to Killing the child process is not working

$child_pid = $$;

$$ is not the child process identifier. You have the parent process trying to kill itself.

But, more fundamentally, fork does not work properly on Windows; and you are wasting your time writing new code that tries to use it.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re: Killing the child process is not working
Select or Download Code
Re^2: Killing the child process is not working
by srlbharu (Acolyte) on Mar 20, 2013 at 08:02 UTC

    Yes I agree, But I know only one way to create the child to run it parallel to parent in perl 5.6 using fork

    Trying to upgrade the perl version leads to lot of compatibility issues so that I stopped my trails to upgrade

    Here I am getting the error: "Attemt to free uneferenced scalar" with perl 5.6 while exiting the child process and then terminating the parent process also. Hence I keep the child in infinite loop and once the parent is going to be completed I want to kill the child by sending signal like CTRL+C

    I tried the ways like die, exit, Win32::Process::Killprocess and kill 9,$pid; to kill the child no use

      But I know only one way to create the child to run it parallel to parent in perl 5.6 using fork

      If all you want it to run an asynchronous process, try my $childPid = system 1, q[theCommand and args];.

      But don;t expect much help if you run into problems. On 5.6, you are on your own. Noone wants to be bothered trying to re-debug code that has long since been fixed.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        The system 1, $cmd does not work.

        Can you please let me know how to get the child process id in the Child code? If I know that I will try to send the SIG{INT} interrupt, because manual CTRL-C gets me into the interrupt handler for $SIG{INT} and program execution stops

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2014-12-20 02:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (95 votes), past polls