dup stdio handles for P2P proxy

Special remotes might output to stdout, or read from stdin, which would
mess up the P2P protocol. So dup the handles to avoid any such problem.
This commit is contained in:
Joey Hess 2024-07-01 10:04:45 -04:00
parent cecd151e23
commit 0dfdc9f951
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 17 additions and 9 deletions

View file

@ -99,7 +99,7 @@ performProxyCluster clientuuid clusteruuid servermode = do
proxyClientSide :: UUID -> Annex ClientSide
proxyClientSide clientuuid = do
clientrunst <- liftIO (mkRunState $ Serving clientuuid Nothing)
return $ ClientSide clientrunst (stdioP2PConnection Nothing)
ClientSide clientrunst <$> liftIO (stdioP2PConnectionDupped Nothing)
p2pErrHandler :: Annex () -> (a -> CommandPerform) -> Annex (Either ProtoFailure a) -> CommandPerform
p2pErrHandler closeconn cont a = a >>= \case