Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,18 @@ public boolean installEsptool(Consumer<String> onLine) {
}
}
p.waitFor();

// After pip installs a new package, the shell may cache "command not found".
// Brief pause + retry ensures the newly installed esptool is discoverable.
checkAll();
if (esptoolCmd == null) {
try {
Thread.sleep(500);
} catch (InterruptedException ignored) {
Thread.currentThread().interrupt();
}
checkAll();
}
return esptoolCmd != null;
} catch (IOException | InterruptedException e) {
Thread.currentThread().interrupt();
Expand Down
16 changes: 6 additions & 10 deletions src/main/java/com/ajinkyagokhale/espflasher/ui/FlasherApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -1067,30 +1067,26 @@ private Map<String, List<FirmwareDefinition>> groupByCategory() {
private void checkPrerequisites() {
statusLabel.setText("Checking prerequisites...");

// Run check in background, then update UI once result is known
Thread thread = new Thread(() -> {
prereqChecker.checkAll();
Platform.runLater(() -> {
if (prereqChecker.isReady()) {
statusLabel.setText("Ready.");
} else if (prereqChecker.getPythonCmd() == null) {
showPythonMissingDialog();
} else {
// Python exists but esptool doesn't — offer to install
statusLabel.setText("esptool not found — click here to install.");
statusLabel.setStyle("-fx-text-fill: #2196f3; -fx-underline: true; -fx-cursor: hand;");
statusLabel.setOnMouseClicked(e -> installEsptool());
// Auto-trigger install dialog on first run
autoInstallEsptool();
}
});
});
thread.setDaemon(true);
thread.start();

Platform.runLater(() -> {
if (prereqChecker.isReady()) {
statusLabel.setText("Ready.");
} else if (prereqChecker.getPythonCmd() == null) {
showPythonMissingDialog();
} else {
autoInstallEsptool();
}
});
}

private void installEsptool() {
Expand Down
Loading