@@ -36,6 +36,7 @@ def cli(ctx, environment, target, upload_port):
36
36
getmtime (_pioenvs_dir )):
37
37
rmtree (_pioenvs_dir )
38
38
39
+ found_error = False
39
40
_first_done = False
40
41
for section in config .sections ():
41
42
# skip main configuration section
@@ -56,9 +57,13 @@ def cli(ctx, environment, target, upload_port):
56
57
if _first_done :
57
58
click .echo ()
58
59
59
- process_environment (ctx , envname , options , target , upload_port )
60
+ if not process_environment (ctx , envname , options , target , upload_port ):
61
+ found_error = True
60
62
_first_done = True
61
63
64
+ if found_error :
65
+ raise exception .ReturnErrorCode ()
66
+
62
67
63
68
def process_environment (ctx , name , options , targets , upload_port ):
64
69
terminal_width , _ = click .get_terminal_size ()
@@ -72,8 +77,8 @@ def process_environment(ctx, name, options, targets, upload_port):
72
77
click .secho ("-" * terminal_width , bold = True )
73
78
74
79
result = _run_environment (ctx , name , options , targets , upload_port )
75
- is_error = "error" in result ['err' ].lower ()
76
80
81
+ is_error = result ['returncode' ] != 0
77
82
summary_text = " Took %.2f seconds " % (time () - start_time )
78
83
half_line = "=" * ((terminal_width - len (summary_text ) - 10 ) / 2 )
79
84
click .echo ("%s [%s]%s%s" % (
@@ -84,6 +89,8 @@ def process_environment(ctx, name, options, targets, upload_port):
84
89
half_line
85
90
), err = is_error )
86
91
92
+ return not is_error
93
+
87
94
88
95
def _run_environment (ctx , name , options , targets , upload_port ):
89
96
variables = ["PIOENV=" + name ]
0 commit comments