Skip to content

Commit

Permalink
connect to remote repl only when hostname and port is set (fixes #110)
Browse files Browse the repository at this point in the history
  • Loading branch information
albertlatacz committed Dec 6, 2016
1 parent 5068751 commit 76e0327
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/javarepl/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ private static String welcomeInstructions() {
private static JavaREPLClient clientFor(Option<String> hostname, Option<Integer> port) throws Exception {
console.printInfo(welcomeMessage());

if (hostname.isEmpty() && port.isEmpty()) {
return startNewLocalInstance("localhost", randomServerPort());
if (hostname.isDefined() && port.isDefined()) {
return connectToRemoteInstance(hostname.get(), port.getOrElse(randomServerPort()));
} else {
return connectToRemoteInstance(hostname.getOrElse("localhost"), port.getOrElse(randomServerPort()));
return startNewLocalInstance("localhost", port.getOrElse(randomServerPort()));
}
}

Expand Down

0 comments on commit 76e0327

Please sign in to comment.