.bat from xterm opens cmd.exe window

Christopher Faylor cgf@redhat.com
Tue Apr 1 00:00:00 GMT 2003

On Wed, Jan 08, 2003 at 07:01:08PM -0500, Igor Pechtchanski wrote:
>On Wed, 8 Jan 2003, Alexander Gottwald wrote:
>> On Wed, 8 Jan 2003, Igor Pechtchanski wrote:
>> > > > echo sleep 10 > test.bat
>> > > > ./test.bat
>> I had not verified that. How, after Igor stated that cmd shows up in xterm I
>> tried this too and it works for me. Even the snippet above displays in the
>> xterm window.
>> bye
>>         ago
>FWIW, I'm getting the same behavior as reported by the original poster
>(i.e., any cygwin program called from a batch file from an xterm pops up a
>new window).
>However, I believe I have an explanation of what's happening, though not a
>Cygwin programs running in an xterm have a tty that does not have a
>console window associated with it.  When any cygwin program is invoked, it
>checks (through a part of cygwin1.dll) whether it's running in a tty, and
>if so, does not try to manipulate the console at all.  However, when
>cmd.exe is run in such a setting, it loses the tty information.  Thus, a
>program invoked from this cmd.exe session has neither a tty nor a console
>window, so it has to allocate one.  Hope this makes sense.

That sounds like exactly what is going on, Igor.  Thank you for explaining
it so well.

>To the original poster: since there is no way to propagate tty information
>through a cmd.exe session, I suppose the best solution would still be the
>one Alexander proposed, i.e., live with it.  Why would one want to call a
>batch file from an xterm, anyway?

Especially a .bat file that is calling cygwin programs.


More information about the Cygwin-xfree mailing list