On Thu, May 12, 2005 at 09:37:03PM +0200, Roel Schroeven wrote:
>William O'Higgins wrote:
>> It is a simple check to see if the X server is running (this is
>> inelegant, but it works - if you have a better way, I'd love to know
>> about it, but I would like to be able to do things like this in Python -
>> so I might better write scripts with it).
>
>Checking for startx doesn't work if the server is started via xdm (or 
>kdm or gdm). Another solution would be to check for the DISPLAY 
>environment variable, though that solution has problems of it's own.

Absolutely true.  However, in this context I can be assured that if X is
running, it was started by startx.  More importantly, the DISPLAY
environment variable is not usually imported into the shell/process
running a script - exporting ENV willy-nilly into sub-processes and
spawned shells is, from a security standpoint, very, very bad.  I could
just as easily look for X itself, which is more foolproof, but I am only
looking to stump a small sub-set of possible fools.  The set of all
fools is said to be unbounded, making proof against them non-trivial.
Still, I appreciate the advice and suggestions.
-- 

yours,

William

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to