Skip to content

Commit

Permalink
container runlabel respect $PWD
Browse files Browse the repository at this point in the history
When doing environment variable substitution, we need to make sure
$PWD is replaced with the current working directory.

fixes issue containers#2171

Signed-off-by: baude <bbaude@redhat.com>
  • Loading branch information
baude authored and muayyad-alsadi committed Apr 21, 2019
1 parent e0e18ec commit b982a23
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/podman/shared/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,14 @@ func GenerateRunlabelCommand(runLabel, imageName, name string, opts map[string]s
return envmap["OPT2"]
case "OPT3":
return envmap["OPT3"]
case "PWD":
// I would prefer to use os.getenv but it appears PWD is not in the os env list
d, err := os.Getwd()
if err != nil {
logrus.Error("unable to determine current working directory")
return ""
}
return d
}
return ""
}
Expand Down

0 comments on commit b982a23

Please sign in to comment.