home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!sybus.sybus.com!myrddin!tct!chip
- From: chip@tct.com (Chip Salzenberg)
- Subject: Re: system() vs exec()
- Message-ID: <2B30B274.616E@tct.com>
- Date: Thu, 17 Dec 1992 17:01:40 GMT
- References: <mcook.724446650@fendahl.dev.cdx.mot.com> <1992Dec16.160845.17636@news.eng.convex.com>
- Organization: TC Telemanagement, Clearwater, FL
- Lines: 18
-
- According to tchrist@convex.COM (Tom Christiansen):
- > sub system { fork ? wait : exec @_ }
-
- What if fork fails? Try instead:
-
- sub system {
- local($pid) = fork;
- return undef unless defined($pid);
- $pid ? wait : exec @_;
- }
-
- Note that, for non-BSD systems, you should check for EINTR; changes to
- that effect are left as an exercise for the reader. :-)
- --
- Chip Salzenberg at Teltronics/TCT <chip@tct.com>, <73717.366@compuserve.com>
- "you make me want to break the laws of time and space / you make me
- want to eat pork / you make me want to staple bagles to my face /
- and remove them with a pitchfork" -- Weird Al Yankovic, "You Make Me"
-