SPUG: exec question

Dan Ebert mathin at mathin.com
Fri Feb 11 14:40:46 PST 2005


What I wanted to happen was for script A to launch script B then for
script A to exit while script B went on with its job.

With exec() script A (when launched from the command line) didn't return
the prompt after it exec'ed script B.

By using the system() command Tim suggested I get two good things:
1.  the prompt back :)
2.  capture of errors generated by the script B if it can't run.

Anyway, it works now which is the main thing.

Dan.
----------------------------------------------------------
Immigration is the sincerest form of flattery.
	- Unknown
----------------------------------------------------------


On Fri, 11 Feb 2005, Tim Maher wrote:

> On Fri, Feb 11, 2005 at 11:39:49AM -0800, Ben Reser wrote:
> >
> > I perfectly understood why you did what you did.  Using the shell for
> > that is completely wrong IMHO.  It is unnecessary to achieve the desired
> > result and opens you up to security issues.  The little bit of effort to
> > code a fork/exec is offset by simply not having to worry about shell
> > meta-characters.
> >
> > Additionally, he seemed to not want any extra processes hanging around.
>
> On the contrary, he complained that his Perl script wasn't
> continuing to run after he launched the new command with exec,
> which indicated that he was indeed trying to create a new process,
> but he was going about it incorrectly.
>
> Anyway, we've raised some good points here and the original poster
> reports that his problem got solved along the way, so this thread
> has run its course, IMHO.
>
> *--------------------------------------------------------------------------*
> | Tim Maher, PhD     (206) 781-UNIX      (866) DOC-PERL     (866) DOC-UNIX |
> | tim(AT)Consultix-Inc.Com  http://TeachMePerl.Com  http://TeachMeUnix.Com |
> *+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-*
> |      Watch for my upcoming book: "Minimal Perl for UNIX/Linux People"    |
> *--------------------------------------------------------------------------*
> _____________________________________________________________
> Seattle Perl Users Group Mailing List
>      POST TO: spug-list at pm.org
> SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
>     MEETINGS: 3rd Tuesdays, Location: Amazon.com Pac-Med
>     WEB PAGE: http://seattleperl.org/
>



More information about the spug-list mailing list