summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2022-02-24 10:56:58 -0500
committerAndrew Cady <d@jerkface.net>2022-02-24 10:56:58 -0500
commitf56618e40f95d668f869c29683e25a4ccbb3c78d (patch)
tree4c8b3f7a0ee7d81d421994ea2e5c4ca201ce5f72
parent46bca630bff7f30b69757e8f1d0945d447640590 (diff)
factor 'trap ... EXIT' code into function atexit()
-rwxr-xr-xdot/local/bin/xvnc12
1 files changed, 11 insertions, 1 deletions
diff --git a/dot/local/bin/xvnc b/dot/local/bin/xvnc
index ffae919..375d13a 100755
--- a/dot/local/bin/xvnc
+++ b/dot/local/bin/xvnc
@@ -25,6 +25,16 @@ direct_connection()
25 kill $pid 25 kill $pid
26} 26}
27 27
28atexit()
29{
30 [ "$DEBUG" ] || exec 2>/dev/null || true
31 set +e
32 set -- "$X11VNC" "$SSH"
33 ps hu "$@"
34 kill "$@"
35 rm -rf "$OUR_TMP"
36}
37
28share_display() 38share_display()
29{ 39{
30 if [ "$DEBUG" ] 40 if [ "$DEBUG" ]
@@ -39,7 +49,7 @@ share_display()
39 # killall x11vnc 49 # killall x11vnc
40 x11vnc -noxrecord -q -nopw -ncache -ncache_cr -display "${local_display}" -unixsock "$socket_file" & 50 x11vnc -noxrecord -q -nopw -ncache -ncache_cr -display "${local_display}" -unixsock "$socket_file" &
41 X11VNC=$! 51 X11VNC=$!
42 trap '[ "$DEBUG" ] || exec 2>/dev/null; set -- "$X11VNC" "$SSH"; ps hu "$@"; kill "$@"' EXIT 52 trap atexit EXIT
43 53
44 # TODO: spin waiting for port 5500 54 # TODO: spin waiting for port 5500
45 ssh -n \ 55 ssh -n \