From: Simon Marlow Date: Fri, 1 Sep 2006 15:00:16 +0000 (+0000) Subject: fix hDuplicateTo on Windows X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=fe8111f1ad72af9e3787e9088d02519f500b1c49;p=ghc-base.git fix hDuplicateTo on Windows deja vu - I'm sure I remember fixing this before... --- 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_))