fix windows build (and make --stop work on windows, incidentially)

The Utility.PID will clean up other code soon.
This commit is contained in:
Joey Hess 2014-02-11 15:22:08 -04:00
parent 30a474b309
commit c390e896d1
3 changed files with 46 additions and 20 deletions

31
Utility/PID.hs Normal file
View file

@ -0,0 +1,31 @@
{- process ids
-
- Copyright 2014 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
{-# LANGUAGE CPP #-}
module Utility.PID where
#ifndef mingw32_HOST_OS
import System.Posix.Types (ProcessID)
import System.Posix.Process (getProcessID)
#else
import System.Win32.Process (ProcessId)
import System.Win32.Process.Current (getCurrentProcessId)
#endif
#ifndef mingw32_HOST_OS
type PID = ProcessID
#else
type PID = ProcessId
#endif
getPID :: IO PID
#ifndef mingw32_HOST_OS
getPID = getProcessID
#else
getPID = getCurrentProcessId
#endif