gabrieldemarmiesse / python-on-whales

An awesome Python wrapper for an awesome Docker CLI!
MIT License
541 stars 101 forks source link

Podman `container.start(..., attach=True)` does not attach stdout to the terminal. #550

Open jhc4318 opened 7 months ago

jhc4318 commented 7 months ago

When creating a Podman container and starting with attach, the below does not show any stdout from the container, but input is still connected.

Running the code below will block on container.start but not show any output. I can input exit and the rest of the process will continue executing.

podman = DockerClient(client_call=['podman'])
ctr = podman.container.create(<ctr_image>, interactive=True, tty=True)
podman.container.start(ctr, attach=True)

If doing this through the CLI instead, I see the container prompt as expected.

>podman create --name helloworld -it busybox
479b6734402f6e8b54685d8007b4ff53dec0812613476cce90874c6358ec83bf

>podman start --attach helloworld
/ # echo hi
hi
/ # exit

Is this a bug in container.start?

jhc4318 commented 7 months ago

I think this PR resolves it but there are failing tests (expecting the alternative behaviour of not seeing stdout?).

jhc4318 commented 5 months ago

Any updates on this? I'm currently relying on directly using subprocess given the difference in behaviour.

gabrieldemarmiesse commented 5 months ago

It seems there are no recent updates. If you feel up to the task, feel free to continue the PR or open a new one. We'll still credit Lewis for his work on the subject :)

LewisGaul commented 5 months ago

@gabrieldemarmiesse I think the main open question is whether you're happy for this behaviour change to be made (the failing tests on my PR demonstrate how this is technically a breaking change).

gabrieldemarmiesse commented 5 months ago

Sorry, I didn't have my head in the game. I took a look again at the PR. I'll comment there.