R: starxwin.bat always "misfires" the xterm once - it works!

Jon TURNEY jon.turney@dronecode.org.uk
Wed Feb 18 17:14:00 GMT 2009


Owen Rees wrote:
> --On Monday, February 16, 2009 17:40:15 +0100 Franz di Coccio wrote:
> 
>> Marco,
>>
>>  your suggestion to insert
>>
>>
>> %CYGWIN_ROOT%\bin\sleep 4
>>
>> before the xterm launch instruction
>>
>> %RUN% xterm -e /usr/bin/bash -l
>>
>> in starxwin.bat did the trick!
>> Thanks a lot! Grazie!
>>
>> F
>>
>> PS That's a weird behaviour, anyway... I wonder why the pause is needed
>> only for the first execution after the system boot. Whatever... Now it
>> works :)

Because the second time, the X server is already running.

The command to start the X server has --silent-dup-error, so it does nothing 
when the server is already running.

> The problem seems to be the one that prompted the thread that contains 
> this message:
> <http://cygwin.com/ml/cygwin-xfree/2005-04/msg00018.html>
> 
> As I understand it, the process that starts the X server finishes before 
> the X server is ready to accept connections. This means that there is 
> then a race condition between the X server start up and the next command 
> in the startup script. If the server is ready first all is well but if 
> not, the next command - xterm - fails to connect and gives up.

This is correct.

The real solution, is to use startx/xinit, as that actually has code to wait
until the X server is accepting connections before starting the clients.

Making startxwin.bat just launch startx or xinit would also largely solve the 
problem of overwriting people's customisations to startxwin.bat, as it has 
defined places to put those.

Unfortunately, there is one important difference:  xinit does't work quite the 
same way as startxwin.bat, in that it waits for the last client started (or 
the default Xterm) to exit, and when that exits, also kills the X server; 
startxwin just starts everything and exits.

A patch to add a 'don't wait around, just exit' switch to xinit would be most 
useful :-)

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/



More information about the Cygwin-xfree mailing list