2011-08-26 3 views

답변

3

process 라이브러리에는 원하는 기능을 수행하는 readProcessWithExitCode 라이브러리가 있습니다. 예 :

(e,_,_) <- readProcessWithExitCode "unrar" ["unrar", "x", "-p-", "archivename"] "" 
if e == ExitSuccess then ... else ... 

system 명령과 같은 다른 솔루션도 있습니다. 골라보세요.

3

readProcessWithExitCode의 기능은 System.Process입니다.

import Control.Monad 
import System.Directory 
import System.Exit 
import System.Process 

main = do 
    (exitCode, _, _) <- readProcessWithExitCode "unrar" ["x", "archivename"] "" 
    when (exitCode == ExitSuccess) $ removeFile "archivename"