Skip to content

Commit

Permalink
On behalf of johannes@brodwall.com: Fixing the list of extensions to …
Browse files Browse the repository at this point in the history
…search for an executable on Windows, and logging process startup errors. Fixes issue 7514
  • Loading branch information
barancev committed Jun 28, 2014
1 parent 9bce67c commit 203090c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 1 deletion.
4 changes: 4 additions & 0 deletions java/client/src/org/openqa/selenium/os/CommandLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,8 @@ public String toString() {
public void copyOutputTo(OutputStream out) {
process.copyOutputTo(out);
}

public void checkForError() {
process.checkForError();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

class ExecutableFinder {
private static final ImmutableSet<String> ENDINGS = Platform.getCurrent().is(WINDOWS) ?
ImmutableSet.of("", ".exe", ".com", ".bat") : ImmutableSet.of("");
ImmutableSet.of("", ".cmd", ".exe", ".com", ".bat") : ImmutableSet.of("");

private static final Method JDK6_CAN_EXECUTE = findJdk6CanExecuteMethod();

Expand Down
2 changes: 2 additions & 0 deletions java/client/src/org/openqa/selenium/os/OsProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ interface OsProcess {
String getStdOut();

boolean isRunning();

void checkForError();
}
6 changes: 6 additions & 0 deletions java/client/src/org/openqa/selenium/os/UnixProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ public int getExitCode() {
return handler.getExitValue();
}

public void checkForError() {
if (handler.getException() != null) {
log.severe(handler.getException().toString());
}
}

public String getStdOut() {
if (isRunning()) {
throw new IllegalStateException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ public void waitFor(long timeout) throws InterruptedException {
// no-op
}

public void checkForError() {
// no-op
}

public int destroy() {
if (!isRunning()) {
return 0; // Hard code the return value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ public void start() throws IOException {
URL status = new URL(url.toString() + "/status");
new UrlChecker().waitUntilAvailable(20, SECONDS, status);
} catch (UrlChecker.TimeoutException e) {
process.checkForError();
throw new WebDriverException("Timed out waiting for driver server to start.", e);
} finally {
lock.unlock();
Expand Down

0 comments on commit 203090c

Please sign in to comment.