This commit is contained in:
Phillip Webb
2014-06-15 09:09:06 -07:00
parent 2f12dc823c
commit a374929c90
4 changed files with 30 additions and 30 deletions

View File

@@ -169,9 +169,10 @@ public class CommandRunner implements Iterable<Command> {
try {
ExitStatus result = run(argsWithoutDebugFlags);
// The caller will hang up if it gets a non-zero status
return result == null ? 0
: result.isHangup() ? (result.getCode() > 0 ? result.getCode() : 0)
: 0;
if (result != null && result.isHangup()) {
return (result.getCode() > 0 ? result.getCode() : 0);
}
return 0;
}
catch (NoArgumentsException ex) {
showUsage();

View File

@@ -27,12 +27,12 @@ package org.springframework.boot.cli.command.status;
public final class ExitStatus {
/**
* Generic "OK" exit status with zero exit code and hangup=fa;se
* Generic "OK" exit status with zero exit code and {@literal hangup=false}
*/
public static ExitStatus OK = new ExitStatus(0, "OK");
/**
* Generic "not OK" exit status with non-zero exit code and hangup=true
* Generic "not OK" exit status with non-zero exit code and {@literal hangup=true}
*/
public static ExitStatus ERROR = new ExitStatus(-1, "ERROR", true);
@@ -44,7 +44,6 @@ public final class ExitStatus {
/**
* Create a new ExitStatus with an exit code and name as specified.
*
* @param code the exit code
* @param name the name
*/
@@ -90,7 +89,6 @@ public final class ExitStatus {
/**
* Convert the existing code to a hangup.
*
* @return a new ExitStatus with hangup=true
*/
public ExitStatus hangup() {