Skip to content

Commit b71a496

Browse files
committed
Kill active programmer if still alive after closing last IDE window
Fixes arduino#7498
1 parent e1a5be7 commit b71a496

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

app/src/processing/app/Base.java

+9
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import cc.arduino.Constants;
2727
import cc.arduino.UpdatableBoardsLibsFakeURLsHandler;
2828
import cc.arduino.UploaderUtils;
29+
import cc.arduino.packages.Uploader;
2930
import cc.arduino.contributions.*;
3031
import cc.arduino.contributions.libraries.*;
3132
import cc.arduino.contributions.libraries.ui.LibraryManagerUI;
@@ -961,6 +962,14 @@ public boolean handleQuit() {
961962
// ignore
962963
}
963964

965+
// kill uploader (if still alive)
966+
UploaderUtils uploaderInstance = new UploaderUtils();
967+
Uploader uploader = uploaderInstance.getUploaderByPreferences(false);
968+
if (uploader != null && uploader.programmerPid != null && uploader.programmerPid.isAlive()) {
969+
// kill the stuck programmer
970+
uploader.programmerPid.destroyForcibly();
971+
}
972+
964973
if (handleQuitEach()) {
965974
// Save out the current prefs state
966975
PreferencesData.save();

arduino-core/src/cc/arduino/packages/Uploader.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public String getAuthorizationKey() {
106106
}
107107

108108
// static field for last executed programmer process ID
109-
static protected Process programmerPid;
109+
static public Process programmerPid;
110110

111111
protected boolean executeUploadCommand(Collection<String> command) throws Exception {
112112
return executeUploadCommand(command.toArray(new String[command.size()]));

0 commit comments

Comments
 (0)