xpra icon
Bug tracker and wiki

Ticket #2059: wsl.patch

File wsl.patch, 1.8 KB (added by Antoine Martin, 2 years ago)

detect WSL and workaround Popen issue

  • xpra/net/ssh.py

     
    1717from xpra.platform.paths import get_xpra_command, get_ssh_known_hosts_files
    1818from xpra.net.bytestreams import SocketConnection, SOCKET_TIMEOUT, ConnectionClosedException
    1919from xpra.exit_codes import EXIT_SSH_KEY_FAILURE, EXIT_SSH_FAILURE
    20 from xpra.os_util import bytestostr, osexpand, monotonic_time, setsid, nomodule_context, umask_context, WIN32, OSX, POSIX
     20from xpra.os_util import bytestostr, osexpand, monotonic_time, setsid, nomodule_context, umask_context, is_WSL, WIN32, OSX, POSIX
    2121from xpra.util import envint, envbool, nonl, engs
    2222
    2323INITENV_COMMAND = os.environ.get("XPRA_INITENV_COMMAND", "xpra initenv")
     
    7979            env["XPRA_LOG_TO_FILE"] = "0"
    8080            kwargs["env"] = env
    8181        proc = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, **kwargs)
     82        if is_WSL():
     83            #WSL needs to wait before calling communicate?
     84            proc.wait()
    8285        stdout, stderr = proc.communicate()
    8386        log("exec_dialog_subprocess(%s)", cmd)
    8487        if stderr:
  • xpra/os_util.py

     
    356356def is_unity():
    357357    return os.environ.get("XDG_CURRENT_DESKTOP", "").lower().startswith("unity")
    358358
     359def is_WSL():
     360    if not POSIX:
     361        return False
     362    r = None
     363    for f in ("/proc/sys/kernel/osrelease", "/proc/version"):
     364        r = load_binary_file(f)
     365        if r:
     366            break
     367    return r is not None and r.find(b"Microsoft")>=0
     368
     369
    359370def get_generic_os_name():
    360371    for k,v in {
    361372        "linux"     : "linux",