Revert "try to avoid TerminateProcess link error on windows"

This reverts commit 839ec7e26c.

Neither way is working.. The other way failed:

.stack-work\dist\5f9bc736\build\git-annex\git-annex-tmp\Assistant.o:fake:(.text+0x6bb3): undefined reference to `terminatepid'

Seems that winprocess.c is not getting linked in.
This commit is contained in:
Joey Hess 2017-10-24 13:05:24 -04:00
parent bcd394657f
commit 901807cf75
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 15 additions and 17 deletions

View file

@ -11,5 +11,18 @@ module Utility.WinProcess where
import Utility.PID
foreign import ccall unsafe "winprocess.h terminatepid"
terminatePID :: PID -> IO ()
import System.Win32.Process
import Control.Exception (bracket)
import Control.Monad
terminatePID :: PID -> IO ()
terminatePID p = bracket
(openProcess pROCESS_TERMINATE False p)
(void . c_closeProcess)
(\h -> void $ c_TerminateProcess h 1)
foreign import ccall unsafe "windows.h TerminateProcess"
c_TerminateProcess :: ProcessHandle -> Int -> IO Int
foreign import ccall unsafe "windows.h CloseHandle"
c_closeProcess :: ProcessHandle -> IO Bool