diff --git a/arduino-ide-extension/src/node/monitor-manager.ts b/arduino-ide-extension/src/node/monitor-manager.ts index 3a6161e39..9931e3937 100644 --- a/arduino-ide-extension/src/node/monitor-manager.ts +++ b/arduino-ide-extension/src/node/monitor-manager.ts @@ -8,6 +8,7 @@ import { PluggableMonitorSettings, Port, PortIdentifier, + portIdentifierEquals, } from '../common/protocol'; import { CoreClientAware } from './core-client-provider'; import { MonitorService } from './monitor-service'; @@ -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"