[X2Go-Commits] [pyhoca-cli] 01/01: pyhoca-cli main programme: Check for DISPLAY env var being set and having a usable / expectable value.

git-admin at x2go.org git-admin at x2go.org
Wed May 16 10:45:34 CEST 2018


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository pyhoca-cli.

commit 48793e7f8420ddd902bb61c45fbb1ddf18341b54
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Wed May 16 08:45:01 2018 +0000

    pyhoca-cli main programme: Check for DISPLAY env var being set and having a usable / expectable value.
---
 pyhoca-cli | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/pyhoca-cli b/pyhoca-cli
index 3438741..447969b 100755
--- a/pyhoca-cli
+++ b/pyhoca-cli
@@ -30,6 +30,7 @@ import x2go
 
 import sys
 import os
+import re
 
 PROG_NAME = os.path.basename(sys.argv[0]).replace('.exe', '')
 PROG_PID  = os.getpid()
@@ -424,6 +425,12 @@ if __name__ == '__main__':
     parser, args = parseargs()
     args.parser = parser
 
+    if not os.environ.get('DISPLAY'):
+        logger('the display environment variable is unset, can\'t go on without a DISPLAY...', x2go.loglevel_ERROR, )
+        sys.exit(1)
+    elif not re.match("^.*:[0-9]+(|\.[0-9]+)$", os.environ.get('DISPLAY')):
+        logger('the display environment variable\'s value is weird ({val}), can\'t go on with that...'.format(val=os.environ.get('DISPLAY')), x2go.loglevel_ERROR, )
+        sys.exit(1)
     try:
 
         # initialize the X2GoClient context and start the connection to the X2Go server

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pyhoca-cli.git


More information about the x2go-commits mailing list