Mail Archives: cygwin/2014/10/23/14:35: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:mime-version:in-reply-to:references:from:date
|
| :message-id:subject:to:content-type; q=dns; s=default; b=ci+Pits
|
| X6wtdJ75VSu4fSu1ckaJDdKZwf0tPxDGcQF5kVlVzhg5o/BYg1O3NmCZbPdSH73C
|
| OmI8FSldGCRLJpi5E9izT2S0HRrIes70d9aLFYYryrWRj9SJChwhzDvpUj+7UXqT
|
| MUD4Oq6G98hSHofhkn8KTa5Yzhru9+D4evRE=
|
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:mime-version:in-reply-to:references:from:date
|
| :message-id:subject:to:content-type; s=default; bh=QbunCfkO+aDXZ
|
| YwgoP3HSJC8TU8=; b=RBGj9GmsiPw0bxsbdHWcJ7i4r3fDPFV4Y5OAMyEH8p6Ih
|
| H+ruxT1oT+USGFRm5zyV1ueqN1g4Mtp9VBN8Tzpv1Qq8aoMZq78sWG4UIZzndTBm
|
| GYnthTf5fIdjG135bHMFiRUoGcHMreq93y6cPEGKkSyuZcJiwsIhO+LNX8Ofhk=
|
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-Virus-Found: | No
|
X-Spam-SWARE-Status: | No, score=-5.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,FROM_LOCAL_NOVOWEL,HK_RANDOM_ENVFROM,HK_RANDOM_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2
|
X-HELO: | mail-vc0-f179.google.com
|
X-Received: | by 10.220.184.198 with SMTP id cl6mr5496328vcb.36.1414089295077; Thu, 23 Oct 2014 11:34:55 -0700 (PDT)
|
MIME-Version: | 1.0
|
In-Reply-To: | <1414067059.70749.YahooMailNeo@web162802.mail.bf1.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> <CAJ1FpuM=aDE0tAPb5Ez_TwW87j8ypBWp_RncETFaDQdNYLYYzA AT mail DOT gmail 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>
|
From: | Doug Henderson <djndnbvg AT gmail DOT com>
|
Date: | Thu, 23 Oct 2014 12:34:34 -0600
|
Message-ID: | <CAJ1FpuMzZ6_KJqZVFjvW0gnXHXmvvWFzy6D0MSo9ZaS0mXsT8Q@mail.gmail.com>
|
Subject: | Re: run.exe flashes non-hidden console window in cygwin64 on Win7Pro-64
|
To: | "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
|
X-IsSubscribed: | yes
|
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.
Doug
--
Doug Henderson, Calgary, Alberta, Canada
--
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 -