Merge pull request #7455 from giuseppe/trim-init-command

abi: trim init command
This commit is contained in:
OpenShift Merge Robot
2020-08-28 05:53:20 -04:00
committed by GitHub

View File

@ -8,6 +8,7 @@ import (
"os/exec"
"path/filepath"
"strconv"
"strings"
"github.com/containers/common/pkg/config"
"github.com/containers/podman/v2/libpod/define"
@ -73,7 +74,7 @@ func (ic *ContainerEngine) SetupRootless(_ context.Context, cmd *cobra.Command)
initCommand, err := ioutil.ReadFile("/proc/1/comm")
// On errors, default to systemd
runsUnderSystemd := err != nil || string(initCommand) == "systemd"
runsUnderSystemd := err != nil || strings.TrimRight(string(initCommand), "\n") == "systemd"
unitName := fmt.Sprintf("podman-%d.scope", os.Getpid())
if runsUnderSystemd || conf.Engine.CgroupManager == config.SystemdCgroupsManager {