aboutsummaryrefslogtreecommitdiffhomepage
path: root/toplevel
diff options
context:
space:
mode:
authorGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2012-01-26 16:06:14 +0000
committerGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2012-01-26 16:06:14 +0000
commitc51a32a5f3825dfd78212c976fb0d2d62b4e7d71 (patch)
tree0a53e15133cd46ddbe1e64dc9bb03d687b8a1867 /toplevel
parent2e8c3911f22ccfec57f10ece68db731b4753d6c4 (diff)
Fail: discard the effects of a successful command (fix #2682)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@14945 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'toplevel')
-rw-r--r--toplevel/vernac.ml4
1 files changed, 3 insertions, 1 deletions
diff --git a/toplevel/vernac.ml b/toplevel/vernac.ml
index 84e20f5ed..cbd95a4fb 100644
--- a/toplevel/vernac.ml
+++ b/toplevel/vernac.ml
@@ -206,7 +206,9 @@ let rec vernac_com interpfun (loc,com) =
| VernacFail v ->
if not !just_parsing then begin try
- interp v; raise HasNotFailed
+ (* If the command actually works, ignore its effects on the state *)
+ States.with_state_protection
+ (fun v -> interp v; raise HasNotFailed) v
with e -> match real_error e with
| HasNotFailed ->
errorlabstrm "Fail" (str "The command has not failed !")