Open gpongelli opened 1 month ago
I found a workaround passing the Dockerfile as volume, so removing the need to use < character:
session.run(
"podman",
"run",
"--rm",
"-it",
"-v",
"Dockerfile:/Dockerfile",
"-v",
"hadolint.yaml:/hadolint.yaml",
"ghcr.io/hadolint/hadolint",
"hadolint",
"--config",
"/hadolint.yaml",
"/Dockerfile",
external=True,
)
hope this could help other people too.
Alternatively, you could wrap the command in a shell. See https://nox.thea.codes/en/stable/config.html#nox.sessions.Session.run . The <
character is shell syntax for redirecting standard input. (The session.run
function does not wrap commands in a shell, and it does not currently offer a way to redirect standard input.)
Hi @cjolowicz ,
what do you mean with "wrap the command in a shell" ? something like bash -c podman ...
(I'm not aware of windows eqivalent) ?
I'm already doing session.run
command to invoke podman.
Thanks
In short, session.run
doesn't run in a shell and input redirection, i.e. <
, is a feature of the shell.
I don't think this is a bug with nox.
A common way to fix that is to run it in a shell. For example with bash as the shell:
session.run("bash", "-c", "podman run ...")
Current Behavior
Hi, I'm trying to run hadolint tool within nox session in following way, as per their docs:
when the session is executed, on terminal log I get exit code 127 due to < charater escaped:
Expected Behavior
I would be able to execute that command passing the Dockerfile to docker container as it expects.
Steps To Reproduce
No response
Environment
Anything else?
on activated venv, I can manually launch the same command and it works due to < not escaped: