fix(launchHelper): set ExitType to cgroup

ExitType defaults to `main`, which means systemd will kill all processes
in the application cgroup when the "main" process exited.

This default behavior make applications like vscode which will always
daemonlize itself killed immediately by systemd, so we should set this
property to `cgroup` instead.

refer to https://www.freedesktop.org/software/systemd/man/systemd.service.html#ExitType=

Signed-off-by: black-desk <me@black-desk.cn>
This commit is contained in:
black-desk 2023-08-21 13:13:50 +08:00 committed by Comix
parent 920594d6e5
commit 65b6c9eaf0

View File

@ -256,6 +256,11 @@ std::string cmdParse(msg_ptr &msg, std::deque<std::string_view> cmdLines)
return serviceName;
}
if (ret = sd_bus_message_append(msg, "(sv)", "ExitType", "s", "cgroup"); ret < 0) {
sd_journal_perror("append exit type failed.");
return serviceName;
}
if (ret = sd_bus_message_append(msg, "(sv)", "Slice", "s", "app.slice"); ret < 0) {
sd_journal_perror("append application slice failed.");
return serviceName;