summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--redo.cabal2
-rw-r--r--redo.hs5
2 files changed, 4 insertions, 3 deletions
diff --git a/redo.cabal b/redo.cabal
index 00eeaaa..84d5d93 100644
--- a/redo.cabal
+++ b/redo.cabal
@@ -1,5 +1,5 @@
name: redo
-version: 0.1.0
+version: 0.2.0
synopsis: software build system, make replacement, implementation of djb's redo
description: redo builds a target file from source files using a "do" script. It also tracks when source files have changed and rebuilds target files as necessary.
homepage: https://github.com/jekor/redo
diff --git a/redo.hs b/redo.hs
index 927aecf..f0e816a 100644
--- a/redo.hs
+++ b/redo.hs
@@ -10,7 +10,7 @@ import Data.Maybe (listToMaybe)
import GHC.IO.Exception (IOErrorType(..))
import System.Directory (renameFile, removeFile, doesFileExist, getDirectoryContents, removeDirectoryRecursive, createDirectoryIfMissing, getCurrentDirectory, setCurrentDirectory)
import System.Environment (getArgs, getEnvironment, getProgName, lookupEnv)
-import System.Exit (ExitCode(..))
+import System.Exit (ExitCode(..), exitWith)
import System.FilePath (hasExtension, replaceBaseName, takeBaseName, (</>), splitFileName)
import System.IO (hPutStrLn, stderr, hGetLine, withFile, IOMode(..), hFileSize)
import System.IO.Error (ioeGetErrorType, isDoesNotExistError)
@@ -41,7 +41,7 @@ redo target dir = do
unless upToDate' $ maybe missingDo redo' =<< doPath target
where redo' :: FilePath -> IO ()
redo' path = do
- hPutStrLn stderr $ "redo " ++ show (dir </> target)
+ hPutStrLn stderr $ "redo " ++ (if dir == "./" then "" else dir) ++ target
catchJust (guard . isDoesNotExistError)
(removeDirectoryRecursive metaDepsDir)
(\_ -> return ())
@@ -59,6 +59,7 @@ redo target dir = do
else removeFile tmp
ExitFailure code -> do hPutStrLn stderr $ "Redo script exited with non-zero exit code: " ++ show code
removeFile tmp
+ exitWith $ ExitFailure code
tmp = target ++ "---redoing"
metaDepsDir = metaDir </> target
missingDo = do