1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Don't report an exception if waitForUploadPort fails after successfull upload

Fixes #8851
This commit is contained in:
Martino Facchin 2019-07-08 12:07:33 +02:00
parent 99f6043ced
commit ef8d669f6a

View File

@ -210,9 +210,9 @@ public class SerialUploader extends Uploader {
// Reuse waitForUploadPort for this task, but this time we are simply waiting // 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 // 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 // noop
} }
} }
@ -229,13 +229,13 @@ public class SerialUploader extends Uploader {
} }
private String waitForUploadPort(String uploadPort, List<String> before) throws InterruptedException, RunnerException { 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 // Wait for a port to appear on the list
int elapsed = 0; int elapsed = 0;
while (elapsed < 10000) { while (elapsed < timeout) {
List<String> now = Serial.list(); List<String> now = Serial.list();
List<String> diff = new ArrayList<>(now); List<String> diff = new ArrayList<>(now);
diff.removeAll(before); diff.removeAll(before);