Skip to content

Commit

Permalink
no longer calls
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakhellesoy committed Apr 21, 2014
1 parent 08e6b87 commit 6d743c9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
4 changes: 4 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [1.1.7](https://github.com/cucumber/cucumber-jvm/compare/v1.1.6...master) (Git master)

* [Core] `cucumber.api.cli.Main.run` no longer calls `System.exit`, allowing embedding in other tools (Aslak Hellesøy)

## [1.1.6](https://github.com/cucumber/cucumber-jvm/compare/v1.1.5...v1.1.6) (2014-03-24)

* [Guice] Add hookpoints in Cucumber and GuiceFactory ([#634](https://github.com/cucumber/cucumber-jvm/pull/634) Wouter Coekaerts)
Expand Down
15 changes: 12 additions & 3 deletions core/src/main/java/cucumber/api/cli/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,25 @@
public class Main {

public static void main(String[] argv) throws Throwable {
run(argv, Thread.currentThread().getContextClassLoader());
byte exitstatus = run(argv, Thread.currentThread().getContextClassLoader());
System.exit(exitstatus);
}

public static void run(String[] argv, ClassLoader classLoader) throws IOException {
/**
* Launches the Cucumber-JVM command line.
*
* @param argv runtime options. See details in the {@code cucumber.api.cli.Usage.txt} resource.
* @param classLoader classloader used to load the runtime
* @return 0 if execution was successful, 1 if it was not (test failures)
* @throws IOException if resources couldn't be loaded during the run.
*/
public static byte run(String[] argv, ClassLoader classLoader) throws IOException {
RuntimeOptions runtimeOptions = new RuntimeOptions(new ArrayList<String>(asList(argv)));

ResourceLoader resourceLoader = new MultiLoader(classLoader);
ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader);
Runtime runtime = new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions);
runtime.run();
System.exit(runtime.exitStatus());
return runtime.exitStatus();
}
}
2 changes: 1 addition & 1 deletion core/src/main/java/cucumber/runtime/RuntimeOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// IMPORTANT! Make sure USAGE.txt is always uptodate if this class changes.
public class RuntimeOptions {
public static final String VERSION = ResourceBundle.getBundle("cucumber.version").getString("cucumber-jvm.version");
public static final String USAGE = FixJava.readResource("/cucumber/runtime/USAGE.txt");
public static final String USAGE = FixJava.readResource("/cucumber/api/cli/USAGE.txt");

private final List<String> glue = new ArrayList<String>();
private final List<Object> filters = new ArrayList<Object>();
Expand Down

0 comments on commit 6d743c9

Please sign in to comment.