Commit 1ae64d1
committed
linuxsessionmgr: special case VSCode remote session
In a Visual Studio Code remote session, we may be able to launch a
browser without the `DISPLAY` environment variable set. This is because
VSCode sets the `BROWSER` environment variable in remote sessions, such
that it can forward requests to start a browser to the client machine.
However! There are several types of remote session in VSCode, and the
way they handle automatic port forwarding differs slightly. Since a very
common case in GCM for launching the user browser is the ability to
connect back to GCM via localhost:<port>, we only consider a subset of
remote sessions to be able to launch a browser:
* Remote SSH [YES]
* Dev Containers [YES]
* Remote Tunnel [NO]
Sadly, for whatever reason, the remote connection over Microsoft Dev
Tunnels does NOT automatically surface a forwarded port to localhost on
the client. The forwarded port is only available via the devtunnels.ms
URLs.
Detecting the different types of remote session is tricky as it's not
always as explicit as we'd like.
All types: VSCODE_IPC_HOOK_CLI is set.
Dev Containers : REMOTE_CONTAINERS is set.
Remote SSH : SSH_CONNECTION is set.
Remote Tunnel : absense of REMOTE_CONTAINERS and SSH_CONNECTION.
Note, when starting a tunnel server from a regular SSH connection the
SSH_CONNECTION variable gets inherited by the tunnel connections
themselves! This means we need to also check for the absence of SSH_TTY
because the tunnel server unsets this. SSH_TTY is set only in regular
SSH sessions.
Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>1 parent 04b949a commit 1ae64d1
File tree
1 file changed
+47
-0
lines changed1 file changed
+47
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
98 | 145 | | |
99 | 146 | | |
100 | 147 | | |
| |||
0 commit comments