Skip to content

Commit

Permalink
Don't report an exception if waitForUploadPort fails after successful…
Browse files Browse the repository at this point in the history
…l upload

Fixes arduino#8851
  • Loading branch information
facchinm committed Jul 18, 2019
1 parent 99f6043 commit ef8d669
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ public boolean uploadUsingPreferences(File sourcePath, String buildPath, String

// Reuse waitForUploadPort for this task, but this time we are simply waiting
// for one port to reappear. If no port reappears before the timeout, actualUploadPort is selected
finalUploadPort = waitForUploadPort(actualUploadPort, Serial.list(), false);
finalUploadPort = waitForUploadPort(actualUploadPort, Serial.list(), false, 2000);
}
} catch (InterruptedException ex) {
} catch (RunnerException ex) {
// noop
}
}
Expand All @@ -229,13 +229,13 @@ public boolean uploadUsingPreferences(File sourcePath, String buildPath, String
}

private String waitForUploadPort(String uploadPort, List<String> before) throws InterruptedException, RunnerException {
return waitForUploadPort(uploadPort, before, verbose);
return waitForUploadPort(uploadPort, before, verbose, 10000);
}

private String waitForUploadPort(String uploadPort, List<String> before, boolean verbose) throws InterruptedException, RunnerException {
private String waitForUploadPort(String uploadPort, List<String> before, boolean verbose, int timeout) throws InterruptedException, RunnerException {
// Wait for a port to appear on the list
int elapsed = 0;
while (elapsed < 10000) {
while (elapsed < timeout) {
List<String> now = Serial.list();
List<String> diff = new ArrayList<>(now);
diff.removeAll(before);
Expand Down

0 comments on commit ef8d669

Please sign in to comment.