How do you get the process id out of the ProcessHandle in Win XP?
Subject: How do you get the process id out of the ProcessHandle in Win XP?
Newsgroups: gmane.comp.lang.haskell.glasgow.user
Date: 2007-12-20 02:59:58 GMT
Here is what I have tried:
module Main where
import System.Process -- using runInteractiveProcess
import System.Posix.Types
import System.Process.Internals
import Control.Concurrent.MVar
main = do
(input,output,err,ph) <- runInteractiveProcess calc.exe" ([]) Nothing Nothing
p <- Main.getPID ph
putStrLn $ show p --- The output
getPID :: ProcessHandle -> IO CPid
getPID (ProcessHandle p) = do
(OpenHandle pp) <- takeMVar p
return (toPID pp)
toPID :: PHANDLE -> CPid
toPID ph = toEnum $ fromEnum ph
---------------------------------------------------------------------------------------------------------------------------
But the CPid always returns some const value (like 1904 in cygwin; 1916 in cmd.exe)
I think, I saw that CPid was a newtype of Ptr ()
So, currently I need to get the process id from CPid or something else.
All help is appreciated.
John
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users <at> haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RSS Feed