Re: Killing a process created using system

2007-04-25 Thread Tom Phoenix

On 4/25/07, Nath, Alok (STSD) <[EMAIL PROTECTED]> wrote:


Can I send a kill signal to a process which is created using
system call ?


No. system() won't return while the child process is still running.

If you have the process running in parallel (such as with fork, or a
piped open), you should be able to send a kill signal to it from your
Perl process. But system() doesn't run in parallel; it suspends the
parent process.

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Killing a process created using system

2007-04-25 Thread Chas Owens

On 4/25/07, Nath, Alok (STSD) <[EMAIL PROTECTED]> wrote:

Hi,
But for this you need to know the process id.
The system command doesn't returns, I think ?

~AN.


Take a look at the alarm function.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




RE: Killing a process created using system

2007-04-25 Thread Nath, Alok (STSD)
Hi,
But for this you need to know the process id.
The system command doesn't returns, I think ?

~AN.

-Original Message-
From: Owen Cook [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 25, 2007 4:02 PM
To: beginners@perl.org
Subject: Re: Killing a process created using system

On Wed, Apr 25, 2007 at 03:12:38PM +0530, Nath, Alok (STSD) wrote:
> Hi,
>   Can I send a kill signal to a process which is created using 
>   system call ?
> 
>   Basically I wanted to send a CTRL-C signal to the process 
>   created by system call (of course in the same program).
>   
>   Something like this :
>   
>   sub test()
>   {
>   system (create process)
> 
>   now send kill signal ??
>   
>   system (create next process)
>   }
>   Is it possible ?
> 





maybe you want to look at

perldoc -f kill
perldoc -f getppid

as a starter to get you going



Owen

--
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Killing a process created using system

2007-04-25 Thread Owen Cook
On Wed, Apr 25, 2007 at 03:12:38PM +0530, Nath, Alok (STSD) wrote:
> Hi,
>   Can I send a kill signal to a process which is created using 
>   system call ?
> 
>   Basically I wanted to send a CTRL-C signal to the process 
>   created by system call (of course in the same program).
>   
>   Something like this :
>   
>   sub test()
>   {
>   system (create process)
> 
>   now send kill signal ??
>   
>   system (create next process)
>   }
>   Is it possible ?
> 





maybe you want to look at

perldoc -f kill
perldoc -f getppid

as a starter to get you going



Owen

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/