Skip to content

Commit 955f127

Browse files
committed
Put the messages into the correct pipe (stdout vs stderr)
1 parent d537b66 commit 955f127

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

mbed/mbed.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@
151151
_cwd = os.getcwd()
152152

153153
# Logging and output
154-
def log(msg):
155-
sys.stdout.write(msg)
154+
def log(msg, is_error=False):
155+
sys.stderr.write(msg) if is_error else sys.stdout.write(msg)
156156

157157
def message(msg):
158158
return "[mbed] %s\n" % msg
@@ -168,17 +168,17 @@ def action(msg):
168168

169169
def warning(msg):
170170
lines = msg.splitlines()
171-
log(message("WARNING: %s" % lines.pop(0)))
171+
log(message("WARNING: %s" % lines.pop(0)), True)
172172
for line in lines:
173-
log(" %s\n" % line)
174-
log("---\n")
173+
log(" %s\n" % line, True)
174+
log("---\n", True)
175175

176176
def error(msg, code=-1):
177177
lines = msg.splitlines()
178-
log(message("ERROR: %s" % lines.pop(0)))
178+
log(message("ERROR: %s" % lines.pop(0)), True)
179179
for line in lines:
180-
log(" %s\n" % line)
181-
log("---\n")
180+
log(" %s\n" % line, True)
181+
log("---\n", True)
182182
sys.exit(code)
183183

184184
def offline_warning(offline, top=True):

0 commit comments

Comments
 (0)