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=UHL+9LBrWblXn9Q38HEhoIZyPtNQwmfkGef07Dp74ho CWSO8+c19X81ZIfcQcBR+rx7OPhJ5/Dyf9roGsAupoQNd+F9wjphiwNf5kM/fNMZ 15ovZS6/yCwt1mYe0KRTQAE5dnQWCrTlhokT86OwqNM+RGgbawdJXMiVDPRpQSLY = 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=kIeYMOjXltkUR9PwKgvoQV4FMAA=; b=VTNpFkuTyzwXd1v48 dwZim+nrLw9M2La/6ioJVLcCRdqH2UoMSA1Y/34LgzhsMIjDT42w24RyS9ANCa3B HzMMdwQYKiIBAix0NPCUV4ufFpHMsH6AhYhUoaMfgaS50JpdNQAN9rLq6EqaS/lV w4mIDedyVZU2kyjs7Gdx9R/+Ck= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: conssluserg-03.nifty.com DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com 01L17nE5029739 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp; s=dec2015msa; t=1582247270; bh=Q0slNQ9ekGt9R9soxKOvPt5pkmL+tG9PFD4FH23rKpE=; h=Date:From:To:Subject:In-Reply-To:References:From; b=fhj0D7mKkbDBLYzsMAOEmXHYAuKxIXBwCZL7bhEirl86F7+MJySgLLVZlYluPQro5 9sS3sqxzE5dPVTAp6zHVFWqoE70p7JAXeT3zihqXBaz9AphQ0TMG3pwX91kApQCq9r El2BJv7zbXlfByuC71k7AR0hUHRN7uxZFrW7eM0qRvgcz3oqOjhGDghMRcVtxXJRW9 NN0764s5KuD6jRdi9JeHUd69UzAkY0hCPBJhLmqyGoM6+BxrKde8hokB059gf9wysI ucNH4etDFqyxKd3lpVjejyfnW9lwxTjUKUz0SFMqQGj9eV/pglsLrM5RmdhzwhzzAX MDnOlfIcZ64Yw== Date: Fri, 21 Feb 2020 10:07:59 +0900 From: Takashi Yano To: cygwin AT cygwin DOT com Subject: Re: Pipes bug when spawning non-cygwin processes Message-Id: <20200221100759.6377af969a5f93217b488467@nifty.ne.jp> In-Reply-To: <20200221100121.44625484e94eef069f9ff3d8@nifty.ne.jp> References: <20200131072536 DOT da46ccf9cb52b1afdefa2a9a AT nifty DOT ne DOT jp> <20200219044302 DOT bd24ffa7af1f159c67583600 AT nifty DOT ne DOT jp> <20200221100121 DOT 44625484e94eef069f9ff3d8 AT nifty DOT ne DOT jp> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 > > #include > > > > 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 -- 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