minke #5468(2008/01/26 11:20 GMT) [ Haskell ] Rating0/0=0.00
System.Processモジュールの runInteractiveCommand を使用しています。
同モジュールの waitForProcess は System.Exit モジュールの ExitCode型のIOを返します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14
import IO import System.Process import System.Exit run :: String -> IO () run cmd = do (ih, oh, eh, ph) <- runInteractiveCommand cmd putStrLn =<< hGetContents oh status <- waitForProcess ph case status of ExitSuccess -> putStrLn $ cmd ++ " ok" ExitFailure code -> putStr "error: " >> print code main :: IO () main = run "ls -la"
Rating0/0=0.00-0+
[ reply ]
minke
#5468()
[
Haskell
]
Rating0/0=0.00
System.Processモジュールの runInteractiveCommand を使用しています。
同モジュールの waitForProcess は System.Exit モジュールの ExitCode型のIOを返します。
Rating0/0=0.00-0+
[ reply ]