From fe8111f1ad72af9e3787e9088d02519f500b1c49 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Fri, 1 Sep 2006 15:00:16 +0000 Subject: [PATCH] fix hDuplicateTo on Windows deja vu - I'm sure I remember fixing this before... --- GHC/Handle.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/GHC/Handle.hs b/GHC/Handle.hs index be7f147..18bf135 100644 --- a/GHC/Handle.hs +++ b/GHC/Handle.hs @@ -1565,9 +1565,10 @@ dupHandle other_side h_ = do dupHandleTo other_side hto_ h_ = do flushBuffer h_ - new_fd <- throwErrnoIfMinus1 "dupHandleTo" $ - c_dup2 (fromIntegral (haFD h_)) (fromIntegral (haFD hto_)) - dupHandle_ other_side h_ new_fd + -- Windows' dup2 does not return the new descriptor, unlike Unix + throwErrnoIfMinus1 "dupHandleTo" $ + c_dup2 (fromIntegral (haFD h_)) (fromIntegral (haFD hto_)) + dupHandle_ other_side h_ (haFD hto_) dupHandle_ other_side h_ new_fd = do buffer <- allocateBuffer dEFAULT_BUFFER_SIZE (initBufferState (haType h_)) -- 1.7.10.4