我尝试在 Windows 的 cmd.exe 中运行以下 Haskell 程序,在执行 waitForProcess 时,按 ctrl-c 并没有杀死该程序。但如果在 MinGW shell 下运行它就可以工作。有任何想法吗? (注:Windows没有自带“ sleep ”命令,我只是自己写了一个。)
{-# Language OverloadedStrings #-}
import System.Process
main ∷ IO ()
main = do
putStrLn "sleeping"
(_, _, _, pHandle) <-
createProcess CreateProcess {
cmdspec = RawCommand "sleep" ["5"]
, cwd = Nothing
, env = Nothing
, std_in = CreatePipe, std_out = CreatePipe, std_err = CreatePipe
, close_fds = False
, create_group = False
}
waitForProcess pHandle
putStrLn "all done"
最佳答案
看来这是 mingw 和 cygwin 处理控制台的问题:
http://www.mail-archive.com/[email protected]/msg104921.html http://comments.gmane.org/gmane.os.cygwin/135374
关于windows - 在 Haskell 中,waitForProcess 在 Windows 的 cmd.exe 下阻止 Ctrl-C,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14118917/