| 98 | } |
| 99 | |
| 100 | @Override |
| 101 | protected void execute(Terminal terminal, OptionSet options, Environment env) throws Exception { |
| 102 | if (options.nonOptionArguments().isEmpty() == false) { |
| 103 | throw new UserException(ExitCodes.USAGE, "Positional arguments not allowed, found " + options.nonOptionArguments()); |
| 104 | } |
| 105 | if (options.has(versionOption)) { |
| 106 | terminal.println("Version: " + Version.CURRENT |
| 107 | + ", Build: " + Build.CURRENT.hashShort() + "/" + Build.CURRENT.timestamp() |
| 108 | + ", JVM: " + JvmInfo.jvmInfo().version()); |
| 109 | return; |
| 110 | } |
| 111 | |
| 112 | try { |
| 113 | Bootstrap.init(env); |
| 114 | } catch (BootstrapException | RuntimeException e) { |
| 115 | // format exceptions to the console in a special way |
| 116 | // to avoid 2MB stacktraces from guice, etc. |
| 117 | throw new StartupExceptionProxy(e); |
| 118 | } catch (NodeValidationException e) { |
| 119 | throw new UserException(ExitCodes.CONFIG, e.getMessage()); |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * Required method that's called by Apache Commons procrun when |