From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) by sourceware.org (Postfix) with ESMTPS id 05102385840D for ; Thu, 13 Jan 2022 17:07:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 05102385840D Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=kylheku.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=shaw.ca Received: from shw-obgw-4003a.ext.cloudfilter.net ([10.228.9.183]) by cmsmtp with ESMTP id 82BNnXBiE5Rf183ZonDKjg; Thu, 13 Jan 2022 17:07:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=shaw.ca; s=s20180605; t=1642093672; bh=qV5eeFHaSvmr/ouMJJLsBVwo0yzurI7WdebTsdafRqI=; h=To:Subject:Date:From:Cc:In-Reply-To:References; b=gt3fEoYHE3Z8YAdzLwuWi2xZyO2NbWbAFwXJZLZ11GCTXNCmGXqe4JNqE2zOWQFjx +jNundlNZtT0D/l4zeRSyHcmh4/9F1J6YJYz0mtypoiT9bWR7nb+I8jFVAW3w9Tz47 ZLyoXQn2pon+tJ3ybeLdoq73Z31MMNFebqx4eztVr6FKanyCIKcRYjev0NY/ZflntZ anMglpOoMieVZ2ztV4m7isY8wN2EZXyhabXZxBHQJzgXJox91kzlC0gTE8MS0N8GV7 FAYbAEOs1vOFckAFiU+fZSCiy/QILIJDNLxy8+k8PDRlk3XRzeCXCfG+C6yj+Z7j2+ YDxGJGvuki5ng== Received: from kylheku.com ([70.79.182.7]) by cmsmtp with ESMTPA id 83Znn2rXZNat483Znn51ie; Thu, 13 Jan 2022 17:07:52 +0000 Authentication-Results: ; auth=pass (PLAIN) smtp.auth=kkylheku@shaw.ca X-Authority-Analysis: v=2.4 cv=e9cV9Il/ c=1 sm=1 tr=0 ts=61e05c68 a=pMSlDXUwMa7SJ1EIez8PdQ==:117 a=pMSlDXUwMa7SJ1EIez8PdQ==:17 a=IkcTkHD0fZMA:10 a=SMorJkV_YP8A:10 a=DghFqjY3_ZEA:10 a=5KLPUuaC_9wA:10 a=rfpuTNiaaIeI6PQI96EA:9 a=QEXdDO2ut3YA:10 Received: from www-data by kylheku.com with local (Exim 4.72) (envelope-from <743-406-3965@kylheku.com>) id 1n83Zm-0000p1-To; Thu, 13 Jan 2022 09:07:50 -0800 To: moss@cs.umass.edu Subject: Re: ExitProcess does not work in =?UTF-8?Q?Cygwin=3F?= X-PHP-Originating-Script: 501:rcmail.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Date: Thu, 13 Jan 2022 09:07:50 -0800 From: "Kaz Kylheku (Cygwin)" <743-406-3965@kylheku.com> Cc: Jay K , cygwin@sourceware.org In-Reply-To: <1f98eb84-e3d7-bf0d-875c-3d4818e41aef@cs.umass.edu> References: <1f98eb84-e3d7-bf0d-875c-3d4818e41aef@cs.umass.edu> Message-ID: <72e0f0601676717a2702ff13beb45b80@mail.kylheku.com> X-Sender: 743-406-3965@kylheku.com User-Agent: Roundcube Webmail/0.9.2 X-CMAE-Envelope: MS4xfI9VawQrIGzprsOK8UiGRjuBVk0FxARCyaiez4OipGtNU+Aea6BYdfNytQPS8DSqEksp/Ua7Xbdw6rFQme9FMyG9HNPqgNc3YzAN2Ge4OiubUewMtf0v ls+uTwsGlo3/PwM7UOD5Vqe5ucwxh8cId14zHiNhL2pwufFEKd1vsZW68NdpgfF+Zi8ecNpmCURZGrgs8j7O6Q2YweR0SqV4wiRcKgV+w6O35cVIKN02wRwK X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, FROM_STARTS_WITH_NUMS, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jan 2022 17:07:54 -0000 On 2022-01-13 05:40, Eliot Moss wrote: > On 1/13/2022 1:39 AM, Jay K wrote: >> ExitProcess does not work in Cygwin? >=20 > ExitProcess does not appear to be a POSIX function. This is a real issue worth looking into. Though ExitProcess isn't a=20 POSIX function, Cygwin can capture the termination status of non-Cygwin=20 programs. The concept of termination status cannot be entirely walled off in a private Cygwin garden; it belongs to the underlying platform. In Cygwin, I can do this: C:\Cygwin\cygwin64\home\kaz>exit 1 1:BLACKBOX:~$ 1:BLACKBOX:~$ echo $? 1 0:BLACKBOX:~$ cmd Microsoft Windows [Version 10.0.19042.1052] (c) Microsoft Corporation. All rights reserved. C:\Cygwin\cygwin64\home\kaz>exit 0 0:BLACKBOX:~$ The number in my Bash prompt is the last exit code. As you can see, the non-Cygwin CMD.EXE program produces a termination code which is recognized in the Cygwin world. Most likely it does that via ExitProcess. It is odd if calling ExitProcess in a Cygwin process causes a Cygwin parent not to similarly process the status, as seems to be shown by Jay's test cases. Cygwin supports non-POSIX programming; you can write GUI applications using Win32 calls for instance. (Now I agree that for exiting your process, even if it's a GUI application using numerous win32 calls, you should probably do it the Cygwin way, and use exit, or return from main. But still ...)