Skip to content

Commit

Permalink
fix: use machinectl instead of systemd-run
Browse files Browse the repository at this point in the history
  • Loading branch information
gerblesh committed Dec 23, 2024
1 parent 10acbfe commit 758e07f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pkg/session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,14 @@ func RunLog(logger *slog.Logger, level slog.Level, command *exec.Cmd) ([]byte, e
func RunUID(logger *slog.Logger, level slog.Level, uid int, command []string, env map[string]string) ([]byte, error) {
// Just fork systemd-run, we don't need to rewrite systemd-run with dbus
cmdArgs := []string{
"/usr/bin/systemd-run",
"--machine",
fmt.Sprintf("%d@", uid),
"--pipe",
"/usr/bin/machinectl",
"shell",
"--quiet",
fmt.Sprintf("%d@", uid),
}
if uid != 0 {
cmdArgs = append(cmdArgs, "--user")
}
// if uid != 0 {
// cmdArgs = append(cmdArgs, "--user")
// }
cmdArgs = append(cmdArgs, command...)

cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...)
Expand Down

0 comments on commit 758e07f

Please sign in to comment.