From roberthpike at yahoo.com Wed Dec 27 07:33:53 2017 From: roberthpike at yahoo.com (Robert Pike) Date: Wed, 27 Dec 2017 15:33:53 +0000 (UTC) Subject: [kw-pm] Fork / Independent child process References: <1610776398.4344218.1514388833893.ref@mail.yahoo.com> Message-ID: <1610776398.4344218.1514388833893@mail.yahoo.com> It's been awhile since I've asked a question on here, mainly because I've been using other languages since, but here goes. I have a CGI application that accepts selection criteria from a user that is then used to select data from a MySQL database and generate reports.? Some of these reports can take some time to run so when the main CGI script is called I want to spawn off a call to a script that does the data selection and report generation. I've tried the following and it appears that the child is called fine but the parent script still waits for it (child process) to finish. #*** $parmList is just a list of name-value pairingsif ($pid = fork) {} else {? ? ? close (STDOUT);? ? ? exec ($parmSetup{"directory"}{"intExecPath"}."XMLStandAlone.exe ".$parmList);} -------------- next part -------------- An HTML attachment was scrubbed... URL: From kw-pm at datademons.com Wed Dec 27 20:21:17 2017 From: kw-pm at datademons.com (Justin W) Date: Wed, 27 Dec 2017 23:21:17 -0500 Subject: [kw-pm] Fork / Independent child process In-Reply-To: <1610776398.4344218.1514388833893@mail.yahoo.com> References: <1610776398.4344218.1514388833893.ref@mail.yahoo.com> <1610776398.4344218.1514388833893@mail.yahoo.com> Message-ID: <20171227232117.3ff79ef3@broki.home.datademons.com> Close STDERR in the child too -- your browser is hanging around waiting for that filehandle to eof too. Justin On Wed, 27 Dec 2017 15:33:53 +0000 (UTC) Robert Pike wrote: > It's been awhile since I've asked a question on here, mainly because I've > been using other languages since, but here goes. I have a CGI application > that accepts selection criteria from a user that is then used to select > data from a MySQL database and generate reports. Some of these reports can > take some time to run so when the main CGI script is called I want to spawn > off a call to a script that does the data selection and report generation. > I've tried the following and it appears that the child is called fine but > the parent script still waits for it (child process) to finish. #*** > $parmList is just a list of name-value pairingsif ($pid = fork) {} else { > ? ? close (STDOUT);? ? ? exec > ($parmSetup{"directory"}{"intExecPath"}."XMLStandAlone.exe ".$parmList);} >