From 76d46d40b58c9896a583fe833f4f4b21f0b7b4c5 Mon Sep 17 00:00:00 2001 From: Akos Kitta Date: Mon, 14 Aug 2023 16:58:28 +0200 Subject: [PATCH] fix: close monitor if port changed during upload the client will automatically request a new monitor with the new port --- arduino-ide-extension/src/node/monitor-manager.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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"