delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2022/01/13/12:08:11

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT sourceware DOT org
Delivered-To: cygwin AT sourceware DOT org
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
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==
Authentication-Results: ; auth=pass (PLAIN) smtp.auth=kkylheku AT shaw DOT 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
To: moss AT cs DOT umass DOT edu
Subject: Re: ExitProcess does not work in =?UTF-8?Q?Cygwin=3F?=
X-PHP-Originating-Script: 501:rcmail.php
MIME-Version: 1.0
Date: Thu, 13 Jan 2022 09:07:50 -0800
From: "Kaz Kylheku (Cygwin)" <743-406-3965 AT kylheku DOT com>
In-Reply-To: <1f98eb84-e3d7-bf0d-875c-3d4818e41aef@cs.umass.edu>
References: <MWHPR1401MB1951896B7184CC9CC408CD07E6539 AT MWHPR1401MB1951 DOT namprd14 DOT prod DOT outlook DOT com>
<1f98eb84-e3d7-bf0d-875c-3d4818e41aef AT cs DOT umass DOT edu>
Message-ID: <72e0f0601676717a2702ff13beb45b80@mail.kylheku.com>
X-Sender: 743-406-3965 AT kylheku DOT 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 AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
Cc: Jay K <jayk123 AT hotmail DOT com>, cygwin AT sourceware DOT org
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

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?
> 
> ExitProcess does not appear to be a POSIX function.

This is a real issue worth looking into. Though ExitProcess isn't a 
POSIX
function, Cygwin can capture the termination status of non-Cygwin 
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 ...)



-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019