CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
How to wait until system() called execution finishes

 



yskumar
New User

Jun 11, 2011, 7:15 AM

Post #1 of 4 (1288 views)
How to wait until system() called execution finishes Can't Post

Hi all,
I want to uninstall and install some softwares in windows through a perl script. For that I will make use of system() function .
ie system(software.exe /s /x -s -v -l) where /s is for silent mode, /x for unistallation and other arguments are for starting the service immediately etc etc.

After this I will use the system function to uninstall some other software . Then once again to install two more softwares.
But each uninstallation and installation will take some time. So my question is which is the best way to wait until one installation or uninstallation finishes so that I can go for the next ?
If I go for attended un/installation it will wait because the software will prompt for user inputs. But I am facing the problem when going for unattended un/installation , it wont wait until the execution finishes and due to that installation of the same software starts before the uninstallation finishes.

Any help will be appreciated.


shawnhcorey
Enthusiast


Jun 12, 2011, 7:38 AM

Post #2 of 4 (1200 views)
Re: [yskumar] How to wait until system() called execution finishes [In reply to] Can't Post

No, a system() call will wait until its sub-process is finished before the Perl script continues. To get things to run in parallel takes more effort than system().

__END__

I love Perl; it's the only language where you can bless your thingy.

Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.

Get Markup Help. Please note the markup tag of "code".


rovf
Veteran

Jun 13, 2011, 5:35 AM

Post #3 of 4 (1175 views)
Re: [shawnhcorey] How to wait until system() called execution finishes [In reply to] Can't Post

Actually, system can be used to run a command in background. You have to supply as first argument the integer 1. This rather obscure feature is described in perlport.


yskumar
New User

Jun 15, 2011, 6:42 AM

Post #4 of 4 (1154 views)
Re: [rovf] How to wait until system() called execution finishes [In reply to] Can't Post

Thank you very much for your response.
Yes System() will wait until it finishes the execution, the problem is because of the software related dependency.

And putting process in background using system() will be a helpful one. I will explore on that. However thank you both.

In Reply To

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives