On Sat, May 30, 2009 at 14:06:10 +1000, Trent W.Buck wrote: > Sat May 30 14:05:38 EST 2009 Trent W. Buck <[email protected]> > * Resolve issue1465: ortryrunning should check error code.
Applied, thanks! Just some quick little review, below. Darcs has code which allows it to try a series of text editors in order if you don't specify one. The idea is that if you don't have emacs, then darcs should try vi and so forth. The problem is that this code is a bit too helpful, in that whenever the get a non-successful exit status from the editor; we try the next one. This means that we can't tell the difference between meaningful failure and the editor simply not existing. Trent's patch tightens this check up by only trying the subsequent editor if the failure was an exit code 126 or 127, or if an exception was raised (do we need to tighten things further, or is that OK?). Resolve issue1465: ortryrunning should check error code. -------------------------------------------------------- > +-- | Given two shell commands as arguments, execute the former. The > +-- latter is then executed if the former failed because the executable > +-- wasn't found (code 127), wasn't executable (code 126) or some other > +-- exception occurred. Other failures (such as the user holding ^C) > +-- do not cause the second command to be tried. > ortryrunning :: IO ExitCode -> IO ExitCode -> IO ExitCode > hunk ./src/Darcs/Utils.hs 111 > -a `ortryrunning` b = do ret <- try a > - case ret of > - (Right ExitSuccess) -> return ExitSuccess > - _ -> b > +a `ortryrunning` b = do > + ret <- try a > + case ret of > + (Right (ExitFailure 126)) -> b -- command not executable > + (Right (ExitFailure 127)) -> b -- command not found > + (Right x) -> return x -- legitimate success/failure > + (Left _) -> b -- an exception -- Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow> PGP Key ID: 08AC04F9
signature.asc
Description: Digital signature
_______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
