Skip to content

Commit

Permalink
FORGE-2441: Avoiding calling post-hooks if exit is called
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Aug 18, 2015
1 parent aa718cf commit ce59212
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ public void initializeUI(UIBuilder context) throws Exception
@Override
public Result execute(UIExecutionContext context) throws Exception
{
Shell shell = (Shell) context.getUIContext().getProvider();
UIContext uiContext = context.getUIContext();
Shell shell = (Shell) uiContext.getProvider();
shell.getConsole().stop();
forge.stop();
uiContext.getAttributeMap().put("org.jboss.forge.exit", Boolean.TRUE);
return Results.success();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,15 @@ public Result execute() throws Exception
try
{
Result result = initialCommand.execute(executionContext);
firePostCommandExecuted(executionContext, listeners, initialCommand, result);
// If exiting, don't do anything
if (!Boolean.TRUE.equals(context.getAttributeMap().get("org.jboss.forge.exit")))
firePostCommandExecuted(executionContext, listeners, initialCommand, result);
return result;
}
catch (Exception e)
{
firePostCommandFailure(executionContext, listeners, initialCommand, e);
if (!Boolean.TRUE.equals(context.getAttributeMap().get("org.jboss.forge.exit")))
firePostCommandFailure(executionContext, listeners, initialCommand, e);
throw e;
}
}
Expand Down

0 comments on commit ce59212

Please sign in to comment.