This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Cygwin parenting issue
- From: Ken Brown <kbrown at cornell dot edu>
- To: "cygwin at cygwin dot com" <cygwin at cygwin dot com>
- Date: Wed, 1 Jan 2020 23:24:47 +0000
- Subject: Re: Cygwin parenting issue
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu; dkim=pass header.d=cornell.edu; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R11sgrdXMD+sb4cizCMnJdzCkRvqJvtW5kYiDYzOfko=; b=SJ5K1rQbpENHoQe+IZkgZEsWvHiLaJzu0Ywq/DqGdk6UKQSEH3DtKISzmZSWTZZz61fxOjvhWNoKIPSYwJthJ8ftJQnBqUY7Zvpy2vcmwBU0iuGdFhL+78PSxyl6YnzliFi8dfNJwjqcOodt2oq4GqRUP7DIUaJlaRMWPSpvOqxCzFCWf6e+6NP0jx8hHYsMSJ/iTCdqyVtqIL+7VGthvGwZtQGe9yOftVceX01V3sOqnii2+3YQSHIvjpBKIZBK3QQ9wejfnxzz/v1BaaXLerCuvKHkeU3dI5UwsmKCnTHDVt4JrWLP+cgCvagdzKV8maWfTD2Qa/xW6Am+kt807g==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FTtZTBxkh5jbIR7upwQcVFMQxRmnsJ6s+3mVWFpW1hq8o6VANq/wWoslKtK4HHm+ITWQAL1F1fV+DVqLuWBrKnsX6G6UgMwWVR1C91bLYTefafjEc032/n9elXTHfGrCVM0hwFuLo1zl6nqfHF/R4EjgG/FneXogViv24dB2iVC5X1ILjgJSJNXaaOA+S2wV3T4QOy7puSmYnGigsw+P56G5W2Cc/A3Ka+e1U0Aex7H49gXfb1Tao9VNXJSbnorEHbnJmnJGqFaADSE7i3wTQgmrsyiqUOCatPtGaZDP+i7W7Ano9JZfBUNJ95VpYciSfk2fnLK+t8GlJpHeUDYTLQ==
- References: <7cb7cef9-0e4b-8e9d-0c14-ffe3e9e79a13@huarp.harvard.edu>
On 1/1/2020 4:01 PM, Norton Allen wrote:
> I have a project that involves starting a number of programs in the background
> and then monitoring and reporting when they terminate. My approach has been to
> write a small application called 'parent' that loops on waitpid() until there
> are no more children. I invoke it in a script like:
>
> #! /bin/bash
> program1 &
> program2 &
> program3 &
> exec parent
>
> This of course works under Linux, but under Cygwin, although 'ps' documents the
> parent/child relationship, waitpid() immediately returns ECHILD, indicating
> there are no child processes. If I use the shell's waitpid, that works alright,
> so I am wondering whether the problem is a casualty of the exec.
>
> I have a minimal test setup at https://github.com/nthallen/test_parenting, along
> with examples showing how it works under Linux and Cygwin.
This looks like the issue that was reported here:
https://cygwin.com/ml/cygwin/2019-09/msg00263.html
It's been fixed. Try updating the cygwin package.
$ uname -a
CYGWIN_NT-10.0 moufang2 3.1.2(0.340/5/3) 2019-12-29 17:28 x86_64 Cygwin
$ ./parent_test2.sh
Parent pid is 24159
Child pid is 24161
UID PID PPID TTY STIME COMMAND
kbrown 24159 24158 pty4 18:07:48 /usr/bin/bash
kbrown 24162 24159 pty4 18:07:48 /usr/bin/ps
kbrown 24161 24159 pty4 18:07:48 /usr/bin/sleep
Parent PID is 24159
UID PID PPID TTY STIME COMMAND
kbrown 24159 24158 pty4 18:07:48 /tmp/test_parenting/parent_test
kbrown 24161 24159 pty4 18:07:48 /usr/bin/sleep
Process 24161 terminated: status 0000
No more children
Ken
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple