Skip to content

Commit

Permalink
merge this later
Browse files Browse the repository at this point in the history
  • Loading branch information
quintesse committed Nov 21, 2022
1 parent d555483 commit 2c05561
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ protected List<String> generateCommandLineList() throws IOException {
List<String> optionalArgs = new ArrayList<>();

String requestedJavaVersion = getProject().getJavaVersion();
String javacmd;
javacmd = JavaUtil.resolveInJavaHome("jshell", requestedJavaVersion);
if (requestedJavaVersion == null) {
requestedJavaVersion = "9+";
}
String jshcmd = JavaUtil.resolveInJavaHome("jshell", requestedJavaVersion);

// NB: See https://github.com/jbangdev/jbang/issues/992 for the reasons why we
// use the -J flags below
Expand Down Expand Up @@ -91,7 +93,7 @@ protected List<String> generateCommandLineList() throws IOException {
Util.warnMsg("Java Flight Recording not possible when running via jshell.");
}

fullArgs.add(javacmd);
fullArgs.add(jshcmd);
addAgentsArgs(fullArgs);

fullArgs.addAll(jshellOpts(project.getRuntimeOptions()));
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/dev/jbang/cli/TestRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ void testHelloWorldShellNoExit() throws IOException {

String result = prj.cmdGenerator().generate();

assertThat(result, startsWith("jshell"));
assertThat(result, matchesPattern("^.*jshell(.exe)?.*"));
assertThat(result, not(containsString(" ")));
assertThat(result, containsString("helloworld.jsh"));
assertThat(result, not(containsString("--source 11")));
Expand Down Expand Up @@ -662,7 +662,7 @@ void testDependenciesInteractive() throws IOException {

String result = prj.cmdGenerator().generate();

assertThat(result, startsWith("jshell "));
assertThat(result, matchesPattern("^.*jshell(.exe)?.*"));
assertThat(result, (containsString("classpath_example.java")));
// assertThat(result, containsString(" --source 11 "));
assertThat(result, not(containsString(" ")));
Expand Down

0 comments on commit 2c05561

Please sign in to comment.