Switch to the new operations for obtaining OS handles #187
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is another attempt to solve the problem described in #185, one that neither introduces a dependency on
Win32
, as #185 does, nor onghc-internal
, as #186 does. This pull request introduces an alternative implementation ofwithHandleToHANDLE
, which uses the new operations for obtaining operating-system handles that are provided by GHC merge request !14732. For converting from file descriptors to Windows handles, it continues to use the C function_get_osfhandle
directly.Please note the following:
withHandleToHANDLE
that this pull request introduces is only used when compiling with GHC 9.15 or later.withHandleToHANDLE
differs from the behavior of the traditional implementation in that it blocks operations on the given Haskell handle during the execution of the user-provided action, to an extend that interaction with the Windows handle through the Haskell handle is prevented. It should be checked whether this can cause problems inansi-terminal
. Maybe it will even prevent race conditions.