X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org MIME-Version: 1.0 Date: Sun, 5 Apr 2009 22:20:02 +0100 Message-ID: <416096c60904051420h66325080j3b059f3fbb857bde@mail.gmail.com> Subject: popup consoles on Windows 7 From: Andy Koppe To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 Thanks, Chuck and Dave for pointing me towards 'objdump -p'. I'd got as far as trying objdump, but hadn't spotted the -p option. MinTTY is a -mwindows app, which so far seemed to work well on XP and Vista, because no console is popped up, not even momentarily. Not so on Windows 7, unfortunately. forkpty() and execve() are used to create the child process and invoke the command, whereby it appears to be the exec call that causes a console to pop up. I guess the fact that rxvt is a CUI app explains why its trick for creating a hidden console didn't work in MinTTY: rxvt opens that console in the main process, which in a GUI app isn't passed down to a child process. So here's what I've done instead in 0.4-beta1: call AttachConsole(-1) to attach to any parent console from the main mintty process, and call it again from the child process to pass it down to that. If there is no console, create one using AllocConsole (in the child process), and hide it using ShowWindowAsync. Unfortunately two problems have been reported with this. The console isn't always hidden, and a really weird one on a 64-bit Windows 7: when invoking mintty from a bash running in a console, that console window locks up. I'm rather stuck on what to do about those, so suggestions would be welcome. Also, a couple of questions. When mintty is invoked from a shortcut or the Run dialog, the main process actually does get a console, i.e. GetConsoleWindow() returns a handle, but it doesn't appear on the screen, and the child process can't attach to it using AttachConsole(). When invoked from a console or rxvt, GetConsoleWindow() returns null. What's the reason for that? Furthermore, I'd previously seen the popup console problem on an old Cygwin install on XP, but updating cured it. So has this been addressed in the Cygwin DLL in the past, and is it likely that it can be solved for Windows 7 too? Any idea what might have changed in Windows that causes this issue? Btw, XWin is affected by this too. Starting it from a shortcut on Vista is fine, but on 7 multiple consoles pop up briefly, and one stays up. Andy -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/