Here is what I have tried:<br><br>module Main where<br><br>import System.Process -- using runInteractiveProcess <br>import System.Posix.Types<br>import System.Process.Internals<br>import Control.Concurrent.MVar<br><br>
<br>main = do<br> (input,output,err,ph) <- runInteractiveProcess calc.exe" ([]) Nothing Nothing<br> p <- Main.getPID ph<br> putStrLn $ show p --- The output<br><br>getPID :: ProcessHandle -> IO CPid
<br>getPID (ProcessHandle p) = do <br> (OpenHandle pp) <- takeMVar p<br> return (toPID pp)<br><br>toPID :: PHANDLE -> CPid<br>toPID ph = toEnum $ fromEnum ph<br><br>---------------------------------------------------------------------------------------------------------------------------
<br> But the CPid always returns some const value (like 1904 in cygwin; 1916 in cmd.exe)<br><br>I think, I saw that CPid was a newtype of Ptr () <br><br>So, currently I need to get the process id from CPid or something else.
<br><br>All help is appreciated.<br><br>John<br><br><br><br>