8000 Fixed X11 server check without xdpyinfo · Develop-Python/backintime@6646b2d · GitHub
[go: up one dir, main page]

Skip to content

Commit 6646b2d

Browse files
belsanderintelliops
authored andcommitted
Fixed X11 server check without xdpyinfo
Possible that xdpyinfo is not present on the system, then checkXServer fails. First sanity check, then perform xdpyinfo.
1 parent 5fe70a6 commit 6646b2d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

common/tools.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -449,11 +449,14 @@ def checkXServer():
449449
Returns:
450450
bool: ``True`` if X11 server is running
451451
"""
452-
proc = subprocess.Popen(['xdpyinfo'],
453-
stdout = subprocess.DEVNULL,
454-
stderr = subprocess.DEVNULL)
455-
proc.communicate()
456-
return proc.returncode == 0
452+
if which('xdpyinfo') is not None:
453+
proc = subprocess.Popen(['xdpyinfo'],
454+
stdout = subprocess.DEVNULL,
455+
stderr = subprocess.DEVNULL)
456+
proc.communicate()
457+
return proc.returncode == 0
458+
else:
459+
return False
457460

458461
def preparePath(path):
459462
"""

0 commit comments

Comments
 (0)
0