Skip to content

Commit 7797912

Browse files
committed
refactor: co-locate code for tiger's unix socket initialization
No change, just relocates code.
1 parent 4219727 commit 7797912

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

jupyter_remote_desktop_proxy/setup_websockify.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,12 @@
77

88

99
def setup_websockify():
10-
# make a secure temporary directory for sockets
11-
# This is only readable, writeable & searchable by our uid
12-
sockets_dir = tempfile.mkdtemp()
13-
sockets_path = os.path.join(sockets_dir, 'vnc-socket')
1410
vncserver = which('vncserver')
15-
1611
if not vncserver:
1712
raise RuntimeError(
1813
"vncserver executable not found, please install a VNC server"
1914
)
2015

21-
# TigerVNC provides the option to connect a Unix socket. TurboVNC does not.
2216
# TurboVNC and TigerVNC share the same origin and both use a Perl script
2317
# as the executable vncserver. We can determine if vncserver is TigerVNC
2418
# by searching tigervnc string in the Perl script.
@@ -34,6 +28,12 @@ def setup_websockify():
3428
is_tigervnc = "tigervnc" in vncserver_file.read().casefold()
3529

3630
if is_tigervnc:
31+
# Make a secure temporary directory for sockets that is only readable,
32+
# writeable, and searchable by our uid - TigerVNC can listen to a Unix
33+
# socket!
34+
sockets_dir = tempfile.mkdtemp()
35+
sockets_path = os.path.join(sockets_dir, 'vnc-socket')
36+
3737
websockify_args = ['--unix-target', sockets_path]
3838
vnc_args = [vncserver, '-rfbunixpath', sockets_path]
3939
else:

0 commit comments

Comments
 (0)