Closed marhkb closed 1 year ago
The problem was with containers that had TTY allocated. As it turns out the standard Docker format stream is only used for containers without TTY. I added a check in attach to see if container has TTY allocated and if so it uses a different decode function for the incoming stream changing the raw bytes stream into a TtyChunk::Stdout
so that the return type stays the same for both stream types.
This works great. It would be cool if we could also change the return type of Exec::start
to match Container::attach
. I will open a separate report about that.
I try to attach to a simple alpine container. For that, I just use the code from the documentation of the
Container::attach
API likeAdditionally, while executing this piece of code, I run
podman container attach <container>
in Terminal 1 andcurl -X POST --unix-socket /run/user/1000/podman/podman.sock http://d/v4.0.0/libpod/containers/{container}/attach
in Terminal 2.Now, when I type some command in Terminal 1 I can see the input and output in Terminal 2, but the rust code is stuck in await.
Writing within in the rust code seems to work, though. When run the following code, I can see the input and output in both Terminal 1 and Terminal 2.
Are you able to get the reading part working? I had a look into code, but unfortunately without success.
podman version
on the command line: