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:references:message-id:date:from:reply-to :subject:to:in-reply-to:mime-version:content-type; q=dns; s= default; b=U954MNtJ04hP0BlpIZg/ZEwp45Bxv6p4cZFmfujSL5jeVo6yx4gLt vPIJ2u4+tdHVsDg+4tAQKwdc10dsTv/94J+VGSs35mUIvOXNtVi3/95mGQ/gagUX M0l8Qn52yO1OHlcPJz7mNIm+gfcI361gsakbuC4Sxv2SmYhw8605Sk= 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:references:message-id:date:from:reply-to :subject:to:in-reply-to:mime-version:content-type; s=default; bh=9OVQ1DktUGsYJ6l2qgK+dix/cgo=; b=y1zK1vBAISQPQrVOyIYUZTWplG9o P6xOQD4AdIVpz/6vKz1PpyAzQ7syYjTD6U7Jbnlvv8a6goVVcaGTIIx2Wqcipp24 l/JhNrcqFyvntmM2koESXEr4hyObJZ7PedFffJlwc/UYSKa5o9pbUadQ6w4w9GrV HpB4X4uO+rcfY48= 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-Virus-Found: No X-Spam-SWARE-Status: No, score=1.0 required=5.0 tests=AWL,BAYES_20,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,FREEMAIL_REPLYTO_END_DIGIT,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: nm48-vm2.bullet.mail.gq1.yahoo.com References: <1413488630 DOT 82429 DOT YahooMailNeo AT web162806 DOT mail DOT bf1 DOT yahoo DOT com> <544055FF DOT 2030604 AT cs DOT umass DOT edu> <1413517183 DOT 86611 DOT YahooMailNeo AT web162801 DOT mail DOT bf1 DOT yahoo DOT com> <1413517863 DOT 36122 DOT YahooMailNeo AT web162806 DOT mail DOT bf1 DOT yahoo DOT com> <54411638 DOT 2000104 AT cs DOT umass DOT edu> <1413910316 DOT 59036 DOT YahooMailNeo AT web162803 DOT mail DOT bf1 DOT yahoo DOT com> <1245475041 DOT 20141022173600 AT yandex DOT ru> <1414010093 DOT 92003 DOT YahooMailNeo AT web162802 DOT mail DOT bf1 DOT yahoo DOT com> <1606505198 DOT 20141023052833 AT yandex DOT ru> <1414037878 DOT 2285 DOT YahooMailNeo AT web162805 DOT mail DOT bf1 DOT yahoo DOT com> <1414067059 DOT 70749 DOT YahooMailNeo AT web162802 DOT mail DOT bf1 DOT yahoo DOT com> Message-ID: <1414091548.99397.YahooMailNeo@web162806.mail.bf1.yahoo.com> Date: Thu, 23 Oct 2014 12:12:28 -0700 From: John Wiersba Reply-To: John Wiersba Subject: Re: run.exe flashes non-hidden console window in cygwin64 on Win7Pro-64 To: Doug Henderson , "cygwin AT cygwin DOT com" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Thanks, Doug. I use cygstart.exe to start windows programs (such as winword or notepad) from a mintty/bash console in a way that allows the mintty console to be closed while the windows application is still active. I thought run.exe was meant to be used from shortcuts to run cygwin programs without flashing a console window on the desktop. I don't think it's needed to start programs from a mintty console. >________________________________ > From: Doug Henderson >To: "cygwin AT cygwin DOT com" >Sent: Thursday, October 23, 2014 2:34 PM >Subject: Re: run.exe flashes non-hidden console window in cygwin64 on Win7Pro-64 > > >On 23 October 2014 06:24, John Wiersba > wrote: >> Maybe I'm confused. Isn't the purpose of run.exe to start a >> cygwin program without creating a (visible) console window? >> I can just start a cygwin program directly without the indirection of >> run.exe if I don't care about the random flashing console window. >> >> From the run.exe manpage: >> run will do this for you. It works as intermediate and starts a program >> but makes the console window hidden. > >AFAIK, all programs that run in Windows need a window handle in order >to receive events, and to pass to a lot of windows functions. If your >program create a windows before it tries to do anything that requires >a window, that window gets used. When your program does not create its >own windows, the start up code tries to attach you to an existing >console window, and if there is not one, it creates it. > >A Windows GUI program starts at winmain(). This entry point does not >have the same requirements as the C standard main() entry point. >Mainly, you do not have the stdin, stdout, and stderr attached to >anything, and you do not have a window. Creating a console or GUI >window is entirely up to your code. > >Normally, any non-GUI program will attach to the console window where >it starts. A "dos" type program will attach to the window running the >cmd.exe that started it, and a cygwin program will get attached to the >mintty console window to which your shell is attached, > >For both types of non-GUI programs, the msvcrt.dll or cygwin1.dll >runtime code will setup stdin, stdout and stderr before entering >main(). The runtime startup code will create a console window for you >if you did not inherit one from your parent process, and the code will >attach those file pointers to the console window > >In any system: Windows, cygwin, linux, or whatever, to create a >windowless process, you close those initial file pointers or file >handles and fork a new process. In the original process, you close >your window if necessary, you call exit(), and the runtime will close >your window if necessary. In the new process, you do what ever you >want. > >When you have a cmd.exe window, you use "start" to fire off a new >program and control what happens to its window with command line >options. >When you have a shell in a cygwin console, you use "run.exe" at the >shell prompt. >When you use a shortcut, you have not initial window, so the >msvcrt.dll runtime creates one for you, and uses the properties of the >shortcut to control how that window is created. > >At the shell prompt, try the following commands: > >$ /cygdrive/c/windows/system32/notepad.exe > >$ /cygdrive/c/windows/system32/notepad.exe & > >$ run /cygdrive/c/windows/system32/notepad.exe > >$ run /cygdrive/c/windows/system32/notepad.exe & > >use ps to check how the notepad process is connected to cygwin. Try >exiting the shell after the second command to see why you want to use >run. > >Anyway, that's how I think things work. But I may be wrong. It may >give you some ideas on where to look for more correct and/or detailed >answers. -- 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