Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Need Function for Timing out shell commands

by cdarke (Prior)
on Sep 15, 2011 at 07:40 UTC ( #926088=note: print w/ replies, xml ) Need Help??


in reply to Need Function for Timing out shell commands

I need the return value from the shell programm

You cannot use return from a main program, exit should be used instead (did you use warnings and strict?). Problem with exit though is that you can only return a number (between 0..255), not text. If you must return text:

Replace return $status with print $status
In the shell (Bash or Korn):

/home/fred$ result=$(perl gash.pl) /home/fred$ echo $result Timeout


Comment on Re: Need Function for Timing out shell commands
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (12)
As of 2015-07-28 09:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (254 votes), past polls