diff --git a/Utils.hs b/Utils.hs index 83435bd80..b36c90642 100644 --- a/Utils.hs +++ b/Utils.hs @@ -33,7 +33,9 @@ withLedgerDo opts args cmdname cmd = do t <- getCurrentLocalTime tc <- getClockTime let go = cmd opts args . filterAndCacheLedgerWithOpts opts args t rawtext . (\rl -> rl{filepath=f,filereadtime=tc}) - if creating then go rawLedgerEmpty else (runErrorT . parseLedgerFile t) f >>= either (hPutStrLn stderr) go + if creating then go rawLedgerEmpty else (runErrorT . parseLedgerFile t) f + >>= flip either go + (\e -> hPutStrLn stderr e >> exitWith (ExitFailure 1)) -- | Get a Ledger from the given string and options, or raise an error. ledgerFromStringWithOpts :: [Opt] -> [String] -> LocalTime -> String -> IO Ledger diff --git a/tests/unbalanced.test b/tests/unbalanced.test index a677b0b45..84084a821 100644 --- a/tests/unbalanced.test +++ b/tests/unbalanced.test @@ -1,4 +1,3 @@ -# shouldn't exit code be 1 ? -f - register <<< 2009/1/1 a @@ -9,8 +8,8 @@ unexpected end of input could not balance this transaction, amounts do not add up to zero: 2009/01/01 a - b 1.1 - c -1 + b 1.1 + c -1 ->>>= 0 +>>>= 1