Add ExitStatus to Command.run()

The main difference for now is the removal of the --nohup
(slightly hacky) option in TestCommand. Now a TestCommand
can signal to its caller that it wants to be hung up.

Fixes gh-975
This commit is contained in:
Dave Syer
2014-05-28 16:39:05 +01:00
parent 5e3cc95ccf
commit 3c6dfb72c5
21 changed files with 155 additions and 46 deletions

View File

@@ -28,8 +28,9 @@ public class CustomCommand extends AbstractCommand {
}
@Override
public void run(String... args) throws Exception {
public ExitStatus run(String... args) throws Exception {
System.err.println("Custom Command Hello");
return ExitStatus.OK;
}
}

View File

@@ -75,10 +75,7 @@ public class CliTester implements TestRule {
}
public String test(String... args) throws Exception {
String[] argsToUse = new String[args.length + 1];
System.arraycopy(args, 0, argsToUse, 1, args.length);
argsToUse[0] = "--nohup";
Future<TestCommand> future = submitCommand(new TestCommand(), argsToUse);
Future<TestCommand> future = submitCommand(new TestCommand(), args);
this.commands.add(future.get(this.timeout, TimeUnit.MILLISECONDS));
return getOutput();
}