mirror of
https://github.com/apple/container.git
synced 2026-09-08 16:55:41 +00:00
This change adds a new private method `waitIoComplete` on the `LinuxProcess` type. This method is called internally when the user calls `wait` for a process - and it tries to give the IO streams some time to clear their buffers. Internally, this method sets up an `AsyncStream` down which an item is sent when the vsock connection for either stdout/stderr is terminated. We get this termination signal when the readability handler for the associated fd fires with a no available data. Inside the guest - once we are done relaying the IO from the process into the socket connection, we close the socket fd which triggers the above. All this logic is wrapped around a timeout of 3 seconds, just to ensure the method does not block forever. --------- Signed-off-by: Aditya Ramani <a_ramani@apple.com>