delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/02/20/20:02:17

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:in-reply-to
:references:mime-version:content-type:content-transfer-encoding;
q=dns; s=default; b=citbkYDWWvJCGpr3e/GMGcR/psgvuACcVECm8dJu2v0
YO2r9ifIR2RAUqAOgmGXIB8PpQPlkFlbJXI+rlphOiKLygevOCK+Zlym5NtoSOyY
kerqW9cXvDFf/qllTuhPzae/O2cHp5krfc8oMGjzC/5Zzfh7K1Wxu87qa7xvYKDE
=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:in-reply-to
:references:mime-version:content-type:content-transfer-encoding;
s=default; bh=PnAMKvs1Qj75pZdv3bLR6PhcpVk=; b=fZz/pPhC8mReLHF4s
GBBf9p7uLMBcemE9r3LfgbLkJP4gcVCcpxwbfRTG0vtrSAXReXT3+QFS6zjYBGz7
Yme3VgWLRgwttMMdisqRLggbF0b7HQUZ5L50RFHyv0BXflP4rzr7yhoOx3X3+iZt
mbdaZ+6RUOrpIpP1oy5Np2394E=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-5.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=upto, H*i:CAJZe6MBrUcn7Z, H*f:gJhwBh-x, H*i:gJhwBh-x
X-HELO: conssluserg-06.nifty.com
DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com 01L11CsT015198
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp; s=dec2015msa; t=1582246872; bh=USyOzX27x+67C2Nghzj3IEPCITSJ95bXV+0LIuj8JG0=; h=Date:From:To:Subject:In-Reply-To:References:From; b=or3G1Puw+hFTt99JHTa0tdLIE/FVZatk5Z5sfKzX7VdOzIdH7bDOXsmndqw7ZwyhK q4UuA4vk/Zb7g1c34EvXfYjeZGJiKt+wY4ps46qyqpqdPDJBjeTBx6lQcvwR27mNmg UDTG8miPgQpG/ShfaSu2nwv71zlBHKKiXwQZoI/AqxTBX/jB0bOQykXH92U13QeCIc 3gvLqOdQgfzxlGW+7eaujuMgkP+yGkqVK9p6i+5gPsGQ92um9BIkc3OSbQry3sBiIu /5z8gXG6OHnMm0JbBdzvqGQ+lku7Fov/JCLOAO11VpgwZwqrqwyGEfR3tOEfcAmXf7 UMd6RB5hQwJHQ==
Date: Fri, 21 Feb 2020 10:01:21 +0900
From: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
To: cygwin AT cygwin DOT com
Subject: Re: Pipes bug when spawning non-cygwin processes
Message-Id: <20200221100121.44625484e94eef069f9ff3d8@nifty.ne.jp>
In-Reply-To: <CAJZe6MBrUcn7Z=gJhwBh-x+pQ_KkaDvqSpRJn6zQgrg0m6zshw@mail.gmail.com>
References: <CAJZe6MDdZnE7BNZQWSHgaLo6sbx+9KVhG+wKfcruh_exPaZFLQ AT mail DOT gmail DOT com> <20200131072536 DOT da46ccf9cb52b1afdefa2a9a AT nifty DOT ne DOT jp> <CAJZe6MDszFgBvjhga_WCaTKACk3GWbP-jBGsZ3dd-4vMrQ93iQ AT mail DOT gmail DOT com> <CAJZe6MBh5mDzb8JDG+tG7wCq9RdU4CcxF01hNW7Qrj4JqjTZNg AT mail DOT gmail DOT com> <20200219044302 DOT bd24ffa7af1f159c67583600 AT nifty DOT ne DOT jp> <CAJZe6MBrUcn7Z=gJhwBh-x+pQ_KkaDvqSpRJn6zQgrg0m6zshw AT mail DOT gmail DOT com>
Mime-Version: 1.0
X-IsSubscribed: yes

On Thu, 20 Feb 2020 14:33:27 -0500
Edward Lam wrote:
> On Tue, Feb 18, 2020 at 2:43 PM Takashi Yano wrote:
> > Could you please provide a simple test case?
> 
> Here you go:
> 
> // pipes.cpp
> //
> // Compile in a  Visual Studio x64 Native Tools Command Prompt:
> //     cl pipes.cpp /link /subsystem:windows
> //
> // Run from inside a Cygwin shell, the produced pipes.exe
> //
> 
> #include <stdio.h>
> #include <windows.h>
> 
> INT WinMain(HINSTANCE, HINSTANCE, PSTR, INT)
> {
>     printf("This message used to show up in mintty cygwin v.2.11.2 shell!
> or from ssh session\n");
>     return 0;
> }
> // end of pipes.cpp

Thanks for the test case. Indeed, this works upto cygwin 3.0.7,
and does not work in cygwin 3.1.0 or later.

However, I wonder what platform is your program for. This test
case does not work also in native windows command prompt.
Your test case works only in old cygwin pty.

If you want to make a program which works in cygwin pty, you
can use cygwin g++ like:
g++ -mwindows pipes.cpp -o pipes
The binary built by above command works in cygwin pty, but does
not work in cygwin console (cygwin in command prompt) even with
cygwin 3.0.7.

If you want to make a program which works with windows console,
you should change the code like:

INT WinMain(HINSTANCE, HINSTANCE, PSTR, INT)
{
    if (!AttachConsole(ATTACH_PARENT_PROCESS)) AllocConsole();
    freopen("CONOUT$", "w", stdout);
    printf("This message used to show up in mintty cygwin v.2.11.2 shell! or from ssh session\n");
    return 0;
}

-- 
Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>

--
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

- Raw text -


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