pub(crate) async fn join_fetch<T: Debug>(
worker: impl Future<Output = Result<T>>,
driver: impl Future<Output = Result<()>>,
) -> Result<T>Expand description
Use this to process potential errors from a worker and a driver. This is really a brutal hack around the fact that an error can occur on either our side or in the proxy. But if an error occurs on our side, then we will close the pipe, which will also cause the proxy to error out.
What we really want is for the proxy to tell us when it got an
error from us closing the pipe. Or, we could store that state
on our side. Both are slightly tricky, so we have this (again)
hacky thing where we just search for broken pipe in the error text.
Or to restate all of the above - what this function does is check
to see if the worker function had an error and if the proxy
had an error, but if the proxy’s error ends in broken pipe
then it means the real only error is from the worker.