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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Not sure if I follow what you mean, in the second case the reason it is more effective is not because of the pipe but because you store the process id of the child and send a sigkill to that child when you want it to die. I do agree that having a pipe is an unrequired overhead and seems a tad ugly for what you want to achieve. I would recomend that you drop back to basics and fork/exec your child. Fork will return the pid of the child to allow you to kill it later. Just keep in mind that if you start using fork/exec you need to keep track of zombie processes (all described in fork).

As an asside I would Strongly recomend that you do not use kill 9, this sends a sigkill to your child process. SigKill cannot be trapped by the process to allow clean sutdown. The chance that you will leave your child in a mess is high. Send sigquit (3) this is a nice gentle tap on the head requesting the child die. If you feel that it is important to ensure the child dies and you are concerned that the child may ignore sigquit then use waitpid to ensure that the process dies, send sigkill iFF the child refuses to die. --

Zigster


In reply to Re: (Zigster) Timing out shell commands (paranoia) by zigster
in thread Timing out shell commands (paranoia) by bluto

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-25 18:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found