Allow run/exec -e with equals sign in value

Fixes: #798
Signed-off-by: Ari Pollak <ajp@aripollak.com>
This commit is contained in:
Ari Pollak 2024-03-01 16:13:36 -05:00
parent f2f2f15a3b
commit 4c270b9116

View File

@ -2466,7 +2466,7 @@ async def compose_run(compose, args):
cnt["working_dir"] = args.workdir
env = dict(cnt.get("environment", {}))
if args.env:
additional_env_vars = dict(map(lambda each: each.split("="), args.env))
additional_env_vars = dict(map(lambda each: each.split("=", maxsplit=1), args.env))
env.update(additional_env_vars)
cnt["environment"] = env
if not args.service_ports:
@ -2514,7 +2514,7 @@ async def compose_exec(compose, args):
env = dict(cnt.get("environment", {}))
if args.env:
additional_env_vars = dict(
map(lambda each: each.split("=") if "=" in each else (each, None), args.env)
map(lambda each: each.split("=", maxsplit=1) if "=" in each else (each, None), args.env)
)
env.update(additional_env_vars)
for name, value in env.items():