cli: fix service failing to install on older systemd (#167672)

Fixes https://github.com/microsoft/vscode/issues/167671

In newer systemd, enablement is apparently implicit with 'link', but it must be called for older setups.
This commit is contained in:
Connor Peet 2022-11-29 16:34:05 -08:00 committed by GitHub
parent 8d585dbf89
commit a315da7910
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,6 +92,19 @@ impl ServiceManager for SystemdService {
info!(self.log, "Successfully registered service...");
// note: enablement is implicit in recent systemd version, but required for older systems
// https://github.com/microsoft/vscode/issues/167489#issuecomment-1331222826
proxy
.enable_unit_files(
vec![SystemdService::service_name_string()],
/* 'runtime only'= */ false,
/* replace existing = */ true,
)
.await
.map_err(|e| wrap(e, "error enabling unit files for service"))?;
info!(self.log, "Successfully enabled unit files...");
proxy
.start_unit(SystemdService::service_name_string(), "replace".to_string())
.await