Hi Eric, David.

Summary: clean and simple, does what description says.

I do not have time to audit all usages of "exitWith ExitSuccess"
now. But I think we can count on David here. It would be nice to have
a test for posthook more comprehensive than posthook.sh. I will try
to get to this in a day or two...

More comments below.

Regards,
  Dmitry

don't run posthook if the command terminated with exitWith.
-----------------------------------------------------------
David Roundy <[EMAIL PROTECTED]>**20081116230521

hunk ./src/Darcs/Commands/Apply.lhs 170
>                                  fail ("Error applying patch to working 
> dir:\n" ++ show e)
>      sync_repo repository
>      putStrLn "Finished applying..."
> -    exitWith ExitSuccess
>       where fixed_opts = if Interactive `elem` opts
>                          then opts
>                          else All : opts

Remove exitWith, it is not needed here. Moreover exitWith
now prevents from running posthook.

hunk ./src/Darcs/Commands/Repair.lhs 22
>  \begin{code}
>  module Darcs.Commands.Repair ( repair ) where
>  import System.IO
> -import System.Exit ( exitWith, ExitCode(..) )
>
>  import Darcs.Commands
>  import Darcs.Arguments ( DarcsFlag(),

hunk ./src/Darcs/Commands/Repair.lhs 83
>                 putStrLn "Fixing pristine tree..."
>                 replacePristineFromSlurpy repository s
>                 return ()
> -  exitWith ExitSuccess
>
>  \end{code}

Same here.

hunk ./src/Darcs/RunCommand.hs 20
>
>  module Darcs.RunCommand ( run_the_command ) where
>
> -import Control.Exception ( throwIO, Exception ( ExitException ) )
>  import Control.Monad ( unless, when )
>  import System.Console.GetOpt( ArgOrder( Permute, RequireOrder ),
>                                OptDescr( Option ),

hunk ./src/Darcs/RunCommand.hs 54
>  import Darcs.Match ( checkMatchSyntax )
>  import Darcs.Progress ( setProgressMode )
>  import Darcs.RepoPath ( getCurrentDirectory )
> -import Darcs.SignalHandler ( catchNonSignal )
>  import Darcs.Test ( run_posthook, run_prehook )
>  import Darcs.Utils ( formatPath )
>  import Printer ( text )

Remove unused imports.

hunk ./src/Darcs/RunCommand.hs 139
>                    then exitWith preHookExitCode
>                    else do let fixFlag = FixFilePath here cwd
>                            (command_command cmd) (fixFlag : os) ex
> -                            `catchNonSignal`
> -                            (\e -> case e of
> -                                     ExitException ExitSuccess -> return ()
> -                                     _ -> throwIO e)
>                            postHookExitCode <- run_posthook os here

Main change, do not catch "exitWith ExitSuccess" exceptions.

hunk ./src/Darcs/RunCommand.hs 140
> -                          --
>                            exitWith postHookExitCode
>
>  add_command_defaults :: DarcsCommand -> [DarcsFlag] -> IO [DarcsFlag]
_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to