Skip to content

Commit b353ddb

Browse files
committed
don't buffer warnings in the ignore_errors case
Signed-off-by: Jade Abraham <[email protected]>
1 parent 175a718 commit b353ddb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: util/chplenv/utils.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ def set_buffer_warnings(buffer_warnings):
2626
global _buffer_warnings
2727
_buffer_warnings = buffer_warnings
2828

29+
def should_buffer_warnings():
30+
return _buffer_warnings and not ignore_errors
31+
2932
def warning(msg):
3033
if not os.environ.get('CHPLENV_SUPPRESS_WARNINGS'):
31-
if _buffer_warnings:
34+
if should_buffer_warnings():
3235
_warning_buffer.append(msg)
3336
else:
3437
sys.stderr.write('Warning: ')
@@ -50,6 +53,7 @@ def error(msg, exception=Exception):
5053
sys.stderr.write(''.join(out))
5154
else:
5255
# flush warnings, print error, and exit
56+
# technically, there is no need to flush warnings here, but might as well
5357
flush_warnings()
5458
sys.stderr.write(''.join(out))
5559
sys.exit(1)

0 commit comments

Comments
 (0)