Commit Graph

21 Commits

Author SHA1 Message Date
Connor Peet
707f91aaa6 cli: fix 'failed to lookup tunnel' with a name given (#166507)
Fixes https://github.com/microsoft/vscode-cli/issues/563

If a new tunnel `--name` was provided but the existing tunnel was deleted,
the CLI would error out with a lookup failed message. Instead it now
recreates it like it normally would.
2022-11-16 14:10:49 -08:00
Connor Peet
e996746b14 add observability for windows 2022-11-15 20:38:18 -08:00
Connor Peet
1bf3323015 cli: add service integration for macos, observability
Adds support for running the tunnel as a service on macOS via launchservices.

It also hooks up observability (`code tunnel service log`) on macOS and Linux.
On macOS--and later Windows, hence the manual implementation of `tail`--it
saves output to a log file and watches it. On Linux, it simply delegates to
journalctl.

The "tailing" is implemented via simple polling of the file size. I didn't want
to pull in a giant set of dependencies for inotify/kqueue/etc just for this use
case; performance when polling a single log file is not a huge concern.
2022-11-15 15:39:58 -08:00
Connor Peet
0cd1422809 cli: skip glibc check for nixos
Fixes https://github.com/microsoft/vscode-remote-release/issues/7129
2022-11-11 13:32:41 -08:00
Connor Peet
446be2cd8b fixup! clippy suggestion 2022-11-10 09:30:50 -08:00
Connor Peet
d31573550f cli: implement local download fallback
Implements an automatic local download fallback, similar to SSH
(cc @roblourens). If the initial download results in an error, either
in making the request or a 5xx, it'll try to fall back to making the
request locally and streaming it over the tunnel.

This abstracts the request client behing a "SimpleHttp" trait which
either uses to the native reqwest or uses the 'delegated' mode over the
socket.
2022-11-09 15:27:47 -08:00
Connor Peet
ddb025c979 cli: fix install on windows arm64 not working
Fixes #164573
2022-11-07 09:05:04 -08:00
Joyce Er
fe5f564db1 Attempt to fix Rust clippy lint errors (#165377) 2022-11-03 11:19:58 -04:00
Connor Peet
c536595a7f cli: fallback to system installs in the standalone CLI
The standalone CLI should detect and fall back to using and
system-installed VS Code instance, rather than trying to download zips
and manage its own VS Code instances.

There are three approaches used for discovery:

- On Windows, we can easily and quickly read the register to find
  installed versions based on their app ID.
- On macOS, we initially look in `/Applications` and fall back to the
  slow `system_profiler` command to list app .app's if that fails.
- On Linux, we just look in the PATH. I believe all Linux installers
  (snap, dep, rpm) automatically add VS Code to the user's PATH.

Failing this, the user can also manually specify their installation dir,
using the command `code version use stable --install-dir /path/to/vscode`.

Fixes #164159
2022-10-20 10:54:13 -07:00
Connor Peet
ca1766cee4 rm debug code 2022-10-17 14:45:59 -07:00
Connor Peet
1b17ff429b fix clippy errors 2022-10-17 14:35:20 -07:00
Connor Peet
b987cb47f4 fix integrated cli check 2022-10-17 13:53:06 -07:00
Connor Peet
4e9bdbd44f make self-update work on Linux 2022-10-17 13:38:52 -07:00
Connor Peet
84439a87f6 wip 2022-10-14 15:46:49 -07:00
Connor Peet
84a929b8b7 Merge remote-tracking branch 'origin/main' into connor4312/cli-self-update 2022-10-14 14:23:41 -07:00
Connor Peet
8991187c38 cli: apply lint fixes 2022-10-12 22:39:57 -07:00
Connor Peet
889fbd2f1b add detection for integrated cli, verify 2022-09-26 07:22:58 +02:00
Connor Peet
07453efc00 cli: implement better self-updating
- Start separating a "standalone" CLI. This is a little awkward with clap-
  derive, but I got it working. Detection of whether the CLI _is_
  standalone is still todo.
- Remove the old ad-hoc update code for code-server, and use the update
  service instead.
- Fix some of the "permission denied" errors people got while updating
  before. We need to rename the old running binary, not just overwrite it.
2022-09-23 17:47:39 -07:00
Connor Peet
b784bcdd32 cli: use hard tabs to align with vscode style 2022-09-23 14:17:01 -07:00
Connor Peet
54ca489a5b cli: get update endpoint from build 2022-09-22 12:55:28 -07:00
Connor Peet
3762635fe1 move cli to top level 2022-09-20 08:42:44 -07:00