cli: use better approach to Windows services (#172679)

Fixes #167741

This eschews the offical Windows service system in favor of registering
into `HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run`.
Unlike services, this can be done without administrative permissions,
does not require the current username/password, and is not blocked by
miscellaneous and mysterious system policies.

Since the process is basically unmanaged by the OS, this requires a
little legwork to start and stop the process when registering and
unregistering.
This commit is contained in:
Connor Peet
2023-01-27 15:04:56 -08:00
committed by GitHub
parent 2b48ecd3de
commit b5aa3e0a3d
6 changed files with 74 additions and 298 deletions

View File

@@ -61,6 +61,9 @@ pub const QUALITYLESS_SERVER_NAME: &str = concatcp!(QUALITYLESS_PRODUCT_NAME, "
/// Web URL the editor is hosted at. For VS Code, this is vscode.dev.
pub const EDITOR_WEB_URL: Option<&'static str> = option_env!("VSCODE_CLI_EDITOR_WEB_URL");
/// Name shown in places where we need to tell a user what a process is, e.g. in sleep inhibition.
pub const TUNNEL_ACTIVITY_NAME: &str = concatcp!(PRODUCT_NAME_LONG, " Tunnel");
const NONINTERACTIVE_VAR: &str = "VSCODE_CLI_NONINTERACTIVE";
pub fn get_default_user_agent() -> String {