Hi Chuck:
        I don't think exec will do the right thing.
        According to perldoc.perl.org, exec will stop the current process to
execute another one while
system will do a fork() first, so system will be your right choice I think.
        This is a short example I did recently:
        **********************************************
            main program starts here.
            if you system(another program in the foregroud) {
                  you will have to wait until the program finishes.
            }
            elsif you system(another program in the backgroud) {
                  you will get your main program run ahead without having to

                        wait its returen
            }
         ************************************************
         Hope this will give you some clue.


On Thu, Feb 19, 2009 at 8:02 AM, Chas. Owens <chas.ow...@gmail.com> wrote:

> On Wed, Feb 18, 2009 at 12:14, Chuck <c...@unity.ncsu.edu> wrote:
> > Hello,
> >
> > We have a GUI where, if a button is clicked, Putty (the remote access
> > program) is launched using
> >
> > System("C:\\Progra~1\\Putty\\putty.exe");
> >
> > is launched. However, when this is executed, the original GUI freezes,
> > and we cannot use it unless we close Putty. We tried using the fork()
> > command like this:
> >
> > my $pid = fork()
> >
> > if ( $pid == 0 ) {
> >  System("C:\\Progra~1\\Putty\\putty.exe");
> >  exit 0;
> > }
> >
> > Now, if we run it, we can use the original GUI while Putty is running,
> > but when we close Putty, we get an error message along the lines of,
> > "The Perl Command Line Interpreter has stopped working" and the GUI
> > kills itself. Does anyone know what the problem might be, or how we
> > can launch Putty without freezing the GUI or causing it to kill itself
> > after closing Putty?
> >
> > Thanks a lot.
>
> Try replacing the system with exec*.  The exec function will replace
> the currently running process (Perl) with the new one (Putty).
>
> * http://perldoc.perl.org/functions/exec.html

Reply via email to