Skip to content

Commit

Permalink
Merge pull request #43 from hartwork/xpra-connectability
Browse files Browse the repository at this point in the history
Make Xpra connectability check more robust
  • Loading branch information
hartwork authored Dec 17, 2023
2 parents 66465ea + 298f6e1 commit 0f08288
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sandwine/_x11.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,15 @@ def _write_xvfh_wrapper_script_to(xvfb_wrapper_path):
file=f)
os.fchmod(f.fileno(), 0o755) # i.e. make executable

def _wait_for_connectable_xpra_server(self, unix_socket_path: str) -> None:
while True:
ret = subprocess.call([self._command, 'id', unix_socket_path],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
if ret == 0:
return
time.sleep(0.5)

def __enter__(self):
_logger.info(self._message_starting)

Expand Down Expand Up @@ -260,6 +269,7 @@ def __enter__(self):
try:
self._server_process = subprocess.Popen(server_argv)
_wait_until_file_present(unix_socket_path)
self._wait_for_connectable_xpra_server(unix_socket_path)
self._client_process = subprocess.Popen(client_argv, env=client_env)
except FileNotFoundError:
_logger.error(f'Command {self._command!r} is not available, aborting.')
Expand Down

0 comments on commit 0f08288

Please sign in to comment.