Last active
June 14, 2024 04:19
-
-
Save heddxh/57ca9496ab3c77fbbd5bf9ca6f1efb9f to your computer and use it in GitHub Desktop.
Pacman hook to patch visual-studio-code-bin launch script in official binary, adding `exec` to make VSCode launch in correct cgroup with systemd-run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Trigger] | |
Operation = Install | |
Operation = Upgrade | |
Type = Package | |
Target = visual-studio-code-bin | |
[Action] | |
Description = Patching vscode official launch script to avoid lauching in wrong cgroup... | |
Exec = /usr/bin/sed -i -e '$d' -e 's/ELECTRON_RUN_AS_NODE=1 "\$ELECTRON" "\$CLI" "\$@"/ELECTRON_RUN_AS_NODE=1 exec "$ELECTRON" "$CLI" "$@"/' /opt/visual-studio-code/bin/code | |
When = PostTransaction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The problem is, vscode is launched with
ELECTRON_RUN_AS_NODE=1
withoutexec
.When using
systemd-run
to launch it as a service/scope, it will exit immediately.Maybe because the script's PID is watched by systemd but it quit after run as node process, and systemd think the process has finished and remove the service.