diff options
author | Joey Hess <joey@kitenet.net> | 2010-10-14 13:17:43 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-10-14 13:17:43 -0400 |
commit | 7c975eab07d842e3d91626871027f803f34c6372 (patch) | |
tree | a05a3e73d81e3c8d75df547e47a70ce06b91b11c /Backend | |
parent | 8df3e2aa0227e426ade1d92f430e02e31bb97ad9 (diff) |
check rawSystem exit codes
Diffstat (limited to 'Backend')
-rw-r--r-- | Backend/File.hs | 8 | ||||
-rw-r--r-- | Backend/Url.hs | 10 |
2 files changed, 10 insertions, 8 deletions
diff --git a/Backend/File.hs b/Backend/File.hs index 78e1f5563..2ac12487e 100644 --- a/Backend/File.hs +++ b/Backend/File.hs @@ -6,6 +6,7 @@ module Backend.File (backend) where import Control.Monad.State import System.IO import System.Cmd +import System.Exit import Control.Exception import BackendTypes import LocationLog @@ -68,10 +69,11 @@ copyFromRemote r key file = do if (Git.repoIsLocal r) then getlocal else getremote - return () where getlocal = do - rawSystem "cp" ["-a", location, file] - putStrLn "cp done" + res <-rawSystem "cp" ["-a", location, file] + if (res == ExitSuccess) + then return () + else error "cp failed" getremote = error "get via network not yet implemented!" location = annexLocation r backend key diff --git a/Backend/Url.hs b/Backend/Url.hs index e4ba58e6d..9831c337b 100644 --- a/Backend/Url.hs +++ b/Backend/Url.hs @@ -5,7 +5,7 @@ module Backend.Url (backend) where import Control.Monad.State import System.Cmd -import IO +import System.Exit import BackendTypes backend = Backend { @@ -29,7 +29,7 @@ dummyRemove url = return False downloadUrl :: Key -> FilePath -> Annex Bool downloadUrl url file = do liftIO $ putStrLn $ "download: " ++ (show url) - result <- liftIO $ try $ rawSystem "curl" ["-#", "-o", file, (show url)] - case (result) of - Left _ -> return False - Right _ -> return True + result <- liftIO $ rawSystem "curl" ["-#", "-o", file, (show url)] + if (result == ExitSuccess) + then return True + else return False |