public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Subject: Re: Pipes bug when spawning non-cygwin processes
Date: Fri, 21 Feb 2020 01:08:00 -0000	[thread overview]
Message-ID: <20200221100759.6377af969a5f93217b488467@nifty.ne.jp> (raw)
In-Reply-To: <20200221100121.44625484e94eef069f9ff3d8@nifty.ne.jp>

On Fri, 21 Feb 2020 10:01:21 +0900
Takashi Yano wrote:
> 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;
> }

Or just compile with:
cl pipes.cpp /link /subsystem:console

-- 
Takashi Yano <takashi.yano@nifty.ne.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

  reply	other threads:[~2020-02-21  1:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-30 19:04 Edward Lam
2020-01-30 22:25 ` Takashi Yano
2020-01-31  6:25   ` Edward Lam
2020-02-18 19:24     ` Edward Lam
2020-02-18 19:43       ` Takashi Yano
2020-02-20 19:33         ` Edward Lam
2020-02-21  1:01           ` Takashi Yano
2020-02-21  1:08             ` Takashi Yano [this message]
2020-02-21  1:23               ` Takashi Yano
2020-02-24 14:46             ` Edward Lam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200221100759.6377af969a5f93217b488467@nifty.ne.jp \
    --to=takashi.yano@nifty.ne.jp \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).