Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!sharkey!itivax!umich!zip!spencer From: spencer@eecs.umich.edu (Spencer W. Thomas) Newsgroups: comp.windows.x Subject: Re: fork() and popen() in an X environment Message-ID: Date: 8 Sep 89 15:35:39 GMT References: <1015@apctrc.UUCP> Sender: news@zippy.eecs.umich.edu Distribution: na Organization: University of Michigan EECS Dept Lines: 17 In-reply-to: zjmw0a@apctrc.trc.amoco.com's message of 7 Sep 89 22:01:23 GMT Problem summary: process forks, then exits, but windows stay up until subprocess also exits. Solution: (I think) close the display connection after fork and before exec. You can set the "close on exec" flag for the display connection by: #include fcntl( ConnectionNumber(display), F_SETFD, 1 ); Oddities dept: I had to make one other change to get the program to work as advertised: I had to change the pclose to a close, apparently pclose (Sun OS 4.0.1) waits for the child to exit? -- =Spencer (spencer@eecs.umich.edu)