From 69d01c4bc13ee6add806f74375dac5b2b0ef379a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 12 Oct 2018 21:57:57 +0300 Subject: [PATCH] Fix an issue when ``pio run -t monitor`` always uses first ``monitor_port`` even with multiple environments // Resolve #1841 --- HISTORY.rst | 3 +++ platformio/commands/run.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index aee00aa2..488f786c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -21,6 +21,9 @@ PlatformIO 3.0 (`issue #1823 `_) * Fixed an issue when dynamic build flags were not handled correctly (`issue #1799 `_) +* Fixed an issue when ``pio run -t monitor`` always uses first ``monitor_port`` + even with multiple environments + (`issue #1841 `_) 3.6.0 (2018-08-06) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 3264ded0..47f14f81 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -108,7 +108,9 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose, results.append(result) if result[1] and "monitor" in ep.get_build_targets() and \ "nobuild" not in ep.get_build_targets(): - ctx.invoke(cmd_device_monitor) + ctx.invoke( + cmd_device_monitor, + environment=environment[0] if environment else None) found_error = any(status is False for (_, status) in results)