mirror of https://github.com/containers/podman.git
rootless: set XDG_RUNTIME_DIR also for state and exec
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #1048 Approved by: mheon
This commit is contained in:
parent
baa42fd4bd
commit
77758a6c9f
|
@ -425,7 +425,10 @@ func (r *OCIRuntime) updateContainerStatus(ctr *Container) error {
|
||||||
// Store old state so we know if we were already stopped
|
// Store old state so we know if we were already stopped
|
||||||
oldState := ctr.state.State
|
oldState := ctr.state.State
|
||||||
|
|
||||||
out, err := exec.Command(r.path, "state", ctr.ID()).CombinedOutput()
|
cmd := exec.Command(r.path, "state", ctr.ID())
|
||||||
|
cmd.Env = append(cmd.Env, fmt.Sprintf("XDG_RUNTIME_DIR=%s", GetRootlessRuntimeDir()))
|
||||||
|
|
||||||
|
out, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(string(out), "does not exist") {
|
if strings.Contains(string(out), "does not exist") {
|
||||||
ctr.removeConmonFiles()
|
ctr.removeConmonFiles()
|
||||||
|
@ -654,7 +657,7 @@ func (r *OCIRuntime) execContainer(c *Container, cmd, capAdd, env []string, tty
|
||||||
execCmd.Stdout = os.Stdout
|
execCmd.Stdout = os.Stdout
|
||||||
execCmd.Stderr = os.Stderr
|
execCmd.Stderr = os.Stderr
|
||||||
execCmd.Stdin = os.Stdin
|
execCmd.Stdin = os.Stdin
|
||||||
|
execCmd.Env = append(execCmd.Env, fmt.Sprintf("XDG_RUNTIME_DIR=%s", GetRootlessRuntimeDir()))
|
||||||
return execCmd, nil
|
return execCmd, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue