Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Perl script to wait for a program to finish

by ww (Bishop)
on Sep 28, 2011 at 03:46 UTC ( #928232=note: print w/ replies, xml ) Need Help??


in reply to Perl script to wait for a program to finish

My guess: it'll be a lot easier to offer a good explanation if you show us your code.

If I understand what you wrote as you wrote it (intended?), your description doesn't match the way system works -- c.f. perldoc -f system:

system LIST
system PROGRAM LIST
       Does exactly the same thing as "exec LIST", except that a fork
       is done first, and the parent process waits for the child
       process to exit. ....


Comment on Re: Perl script to wait for a program to finish
Download Code
Re^2: Perl script to wait for a program to finish
by pvaldes (Chaplain) on Sep 28, 2011 at 09:45 UTC

    I agree, this is probably a "faux" problem

    If you use system to open a program, i.e:

    `gimp`; print "gimp was closed\n"; print "... lots and lots of commands next";

    the script is stopped until the first line is finished, so the second, third etc lines, are "frozen" and never run until you close manually this gimp session.

     delete a folder which is created by this program after it gets closed by the user

    It depends on your specific case, you could need to add another system line below doing the cleanup, a rmdir $dir line, or nothing

Re^2: Perl script to wait for a program to finish
by renzosilv (Novice) on Sep 28, 2011 at 15:02 UTC
    Sorry I didn't show any code. Is just a few lines long so I didn't think it was necessary. Example: system ("vp -e " . $ENV{'VREL'}); rm /home/$ENV{'verl'}; the problem is my program is dying when the user closes my vp program. I never get to the remove directory. I tried printing for debugging purposes also but my program is dying on that line.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (13)
As of 2014-08-21 14:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (136 votes), past polls