Skip to content

Commit 9b0ac41

Browse files
committed
Fixed an issue when the "Upload & Monitor" task selects the wrong environment // Resolve platformio#2623
1 parent ae44c85 commit 9b0ac41

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Focus on the project configuration output tab only on error (issue [#3535](https://github.com/platformio/platformio-vscode-ide/issues/3535))
77
* Fixed an issue with a task runner on Windows 7 (issue [#3481](https://github.com/platformio/platformio-vscode-ide/issues/3481))
88
* Fixed "Select All", "Undo", and "Redo" operations on macOS for PIO Home (pull [#3451](https://github.com/platformio/platformio-vscode-ide/pull/3451))
9+
* Fixed an issue when the "Upload & Monitor" task selects the wrong environment (issue [#2623](https://github.com/platformio/platformio-vscode-ide/issues/2623))
910

1011
## 3.0.0 (2023-02-01)
1112

src/project/tasks.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,6 @@ export default class ProjectTaskManager {
153153
this._restoreOnDidEndTask = undefined;
154154
this._tasksToRestore = [];
155155
this._autoCloseSerialMonitor(task);
156-
// skip MonitorAndUpload task thatwill be added to this._tasksToRestore
157-
if (
158-
this._tasksToRestore.some((t) => this.isMonitorAndUploadTask(t)) &&
159-
this.isMonitorAndUploadTask(task)
160-
) {
161-
return;
162-
}
163156
// use string-based task defination for Win 7 // issue #3481
164157
vscode.commands.executeCommand(
165158
'workbench.action.tasks.runTask',
@@ -177,20 +170,15 @@ export default class ProjectTaskManager {
177170
}
178171
this._restoreOnDidEndTask = task;
179172
vscode.tasks.taskExecutions.forEach((event) => {
180-
const isMonitorAndUploadTask = this.isMonitorAndUploadTask(event.task);
181173
const skipConds = [
182174
// skip non-PlatformIO task
183175
event.task.definition.type !== ProjectTaskManager.PROVIDER_TYPE,
184176
!event.task.execution.args.includes('monitor'),
185-
this.areTasksEqual(task, event.task) && !isMonitorAndUploadTask,
186177
];
187178
if (skipConds.some((value) => value)) {
188179
return;
189180
}
190-
if (
191-
isMonitorAndUploadTask ||
192-
['device', 'monitor'].every((arg) => event.task.execution.args.includes(arg))
193-
) {
181+
if (!this.isMonitorAndUploadTask(event.task)) {
194182
this._tasksToRestore.push(event.task);
195183
}
196184
event.terminate();
@@ -201,7 +189,7 @@ export default class ProjectTaskManager {
201189
const skipConds = [
202190
!this._restoreOnDidEndTask,
203191
event.execution.task.definition.type !== ProjectTaskManager.PROVIDER_TYPE,
204-
event.exitCode !== 0 && !this.isMonitorAndUploadTask(event.execution.task),
192+
event.exitCode !== 0,
205193
this.areTasksEqual(this._restoreOnDidEndTask, event.execution.task),
206194
];
207195
if (skipConds.some((value) => value)) {

0 commit comments

Comments
 (0)