Skip to content

Commit 39ee234

Browse files
cmagliefacchinm
authored andcommitted
Perform port selection after initializing packages
Fix #8400
1 parent 06ec488 commit 39ee234

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

app/src/processing/app/Base.java

+2
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ public Base(String[] args) throws Exception {
269269
splash.splashText(tr("Initializing packages..."));
270270
BaseNoGui.initPackages();
271271

272+
parser.getUploadPort().ifPresent(BaseNoGui::selectSerialPort);
273+
272274
splash.splashText(tr("Preparing boards..."));
273275

274276
if (!isCommandLine()) {

arduino-core/src/processing/app/helpers/CommandlineParser.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ private enum ACTION {
4141
private String getPref;
4242
private String boardToInstall;
4343
private String libraryToInstall;
44+
private Optional<String> uploadPort = Optional.empty();
4445
private final List<String> filenames = new LinkedList<>();
4546

4647
public CommandlineParser(String[] args) {
@@ -141,7 +142,7 @@ public void parseArgumentsPhase1() {
141142
i++;
142143
if (i >= args.length)
143144
BaseNoGui.showError(null, tr("Argument required for --port"), 3);
144-
BaseNoGui.selectSerialPort(args[i]);
145+
uploadPort = Optional.of(args[i]);
145146
if (action == ACTION.GUI)
146147
action = ACTION.NOOP;
147148
continue;
@@ -356,4 +357,8 @@ public String getLibraryToInstall() {
356357
public boolean isPreserveTempFiles() {
357358
return preserveTempFiles;
358359
}
360+
361+
public Optional<String> getUploadPort() {
362+
return uploadPort;
363+
}
359364
}

0 commit comments

Comments
 (0)