-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{-# LANGUAGE CPP #-} | ||
|
||
{-| | ||
This module intends to make the operations of @System.Posix.Process@ available | ||
on all platforms. | ||
-} | ||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module ProcessSpec (processSpec) where | ||
|
||
import System.PosixCompat | ||
import Test.HUnit | ||
import Test.Hspec | ||
|
||
processSpec :: Spec | ||
processSpec = do | ||
describe "getProcessID" $ do | ||
it "should work on Windows and Unix" $ do | ||
id <- getProcessID | ||
Check warning on line 11 in tests/ProcessSpec.hs GitHub Actions / ubuntu-latest - GHC 9.8
Check warning on line 11 in tests/ProcessSpec.hs GitHub Actions / ubuntu-latest - GHC 9.6
Check warning on line 11 in tests/ProcessSpec.hs GitHub Actions / ubuntu-latest - GHC 9.4
Check warning on line 11 in tests/ProcessSpec.hs GitHub Actions / ubuntu-latest - GHC 9.2
Check warning on line 11 in tests/ProcessSpec.hs GitHub Actions / macOS-latest - GHC 9.8
Check warning on line 11 in tests/ProcessSpec.hs GitHub Actions / macOS-latest - GHC 9.6
Check warning on line 11 in tests/ProcessSpec.hs GitHub Actions / macOS-latest - GHC 9.4
Check warning on line 11 in tests/ProcessSpec.hs GitHub Actions / macOS-latest - GHC 9.2
Check warning on line 11 in tests/ProcessSpec.hs GitHub Actions / windows-latest - GHC 9.8
Check warning on line 11 in tests/ProcessSpec.hs GitHub Actions / windows-latest - GHC 9.6
Check warning on line 11 in tests/ProcessSpec.hs GitHub Actions / windows-latest - GHC 9.4
|
||
assert $ id > 0 |