Skip to content

KProcessRunner: use systemd transient services instead of scopes

Henri Chain requested to merge work/transient-services into master

@davidedmundson added support for attaching launched processes to systemd scopes. This makes systemd responsible for launching and managing the entire lifecycle of the process inside of a cgroup, as recommended in https://systemd.io/DESKTOP_ENVIRONMENTS/

The advantages of this are:

  • it resolves a hypothetical startup race
  • it avoids a bug with scopes and systemd < 238 (https://github.com/systemd/systemd/issues/3388)
  • we get stderr getting redirected nicely into somewhere usable
  • a few more of the drop-in configurations from the cgroup controller can work

This patch also includes:

  • compliance to the new application naming scheme (app-<ApplicationID>@<RANDOM>.service)
  • better escaping of the systemd unit name
  • works around a bug where KService::desktopEntryName forces lowercase (which resulted in inconsistent unit names)

Test plan

  • should work the same on a platform that is not linux, if KDE_APPLICATIONS_AS_SCOPE is not set, or if systemd is not present on the user dbus
  • CommandLauncherJobTest and ApplicationLauncherJobTest should pass

@davidedmundson @dfaure @broulik @meven @ngraham @mlaurent @sitter

Edited by Henri Chain

Merge request reports