Skip to content

Commit

Permalink
add System.PosixCompat.Process
Browse files Browse the repository at this point in the history
  • Loading branch information
ners committed Nov 4, 2023
1 parent 47a4746 commit 24f9a7e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Version 0.7.1 (2023-11-01)

- Add `System.PosixCompat.Process` module

## Version 0.7 (2023-03-15)

- Remote `System.PosixCompat.User` module
- Remove `System.PosixCompat.User` module

## Version 0.6 (2022-05-22)

Expand Down
2 changes: 2 additions & 0 deletions src/System/PosixCompat.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package, on other platforms it emulates the operations as far as possible.
-}
module System.PosixCompat (
module System.PosixCompat.Files
, module System.PosixCompat.Process
, module System.PosixCompat.Temp
, module System.PosixCompat.Time
, module System.PosixCompat.Types
Expand All @@ -15,6 +16,7 @@ module System.PosixCompat (
) where

import System.PosixCompat.Files
import System.PosixCompat.Process
import System.PosixCompat.Temp
import System.PosixCompat.Time
import System.PosixCompat.Types
Expand Down
25 changes: 25 additions & 0 deletions src/System/PosixCompat/Process.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{-# LANGUAGE CPP #-}

{-|
This module makes the operations exported by @System.Posix.Process@
available on all platforms. On POSIX systems it re-exports operations from
@System.Posix.Process@, on other platforms it emulates the operations as far
as possible.
-}
module System.PosixCompat.Process (
getProcessID
) where

#ifdef mingw32_HOST_OS

import System.Posix.Types (ProcessID)
import System.Win32.Process (getCurrentProcessID)

getProcessID :: IO ProcessID
getProcessID = fromIntegral <$> getCurrentProcessID

#else

import System.Posix.Process

#endif
3 changes: 2 additions & 1 deletion unix-compat.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: unix-compat
version: 0.7
version: 0.7.1
synopsis: Portable POSIX-compatibility layer.
description: This package provides portable implementations of parts
of the unix package. This package re-exports the unix
Expand Down Expand Up @@ -36,6 +36,7 @@ Library
System.PosixCompat
System.PosixCompat.Extensions
System.PosixCompat.Files
System.PosixCompat.Process
System.PosixCompat.Temp
System.PosixCompat.Time
System.PosixCompat.Types
Expand Down

0 comments on commit 24f9a7e

Please sign in to comment.