How to detect when a UNIX socket is closed when reading #6207
Unanswered
mikaelstaldal
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Unless you are stuck in |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am developing a program which communicates with a Docker daemon, with HTTP over UNIX socket, using hyperlocal.
The problem I have is that it doesn't detect when the Docker daemon closes the socket. This is necessary when attaching to a container, since I want my program to exit when the container stops and it has consumed all output from the container (just like the
docker attach
command does). If I forcefully exit immediately when the container has stopped, I might miss some output.I want this loop to exit when the socket is closed, but it doesn't:
https://github.com/mikaelstaldal/contained/blob/main/src/docker_client.rs#L197-L201
See whole project here: https://github.com/mikaelstaldal/contained
Beta Was this translation helpful? Give feedback.
All reactions