Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!snorkelwacker!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!wuarchive!emory!mephisto!prism!gt0178a From: gt0178a@prism.gatech.EDU (BURNS,JIM) Newsgroups: comp.unix.questions Subject: Re: getting the exit value of an exec'd program Message-ID: <12635@hydra.gatech.EDU> Date: 16 Aug 90 04:25:11 GMT References: <1990Aug15.223952.1175@NCoast.ORG> Organization: Georgia Institute of Technology Lines: 14 in article <1990Aug15.223952.1175@NCoast.ORG>, atul@NCoast.ORG (Atul Parulekar) says: > May be the answer is in the manual, but I have not been able to find it. > My problem is that if I run a program using fork and execvp, how do I get > the exit value of the exec'd program into the main program. Exec doesn't return a status - it doesn't return at all. Use wait(2) in the parent program. Its man page describes the union wait status variable returned by wait(2) and its variants. (Exact return type also varies between wait() variants and diff. unices.) -- BURNS,JIM Georgia Institute of Technology, Box 30178, Atlanta Georgia, 30332 uucp: ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a Internet: gt0178a@prism.gatech.edu