Skip to content

Commit

Permalink
fix: close monitor if port changed during upload
Browse files Browse the repository at this point in the history
the client will automatically request a new monitor with the new port
  • Loading branch information
Akos Kitta committed Aug 14, 2023
1 parent 97f1801 commit 76d46d4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arduino-ide-extension/src/node/monitor-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
PluggableMonitorSettings,
Port,
PortIdentifier,
portIdentifierEquals,
} from '../common/protocol';
import { CoreClientAware } from './core-client-provider';
import { MonitorService } from './monitor-service';
Expand Down Expand Up @@ -214,7 +215,11 @@ export class MonitorManager extends CoreClientAware {

const monitor = this.monitorServices.get(beforeMonitorID);
if (monitor) {
await monitor.start();
if (portIdentifierEquals(beforePort, afterPort)) {
await monitor.start();
} else {
await monitor.stop();
}
}

// this monitorID will only be present in "disposedForUpload"
Expand Down

0 comments on commit 76d46d4

Please sign in to comment.