Skip to content

Commit b123bed

Browse files
authored
fix: Fix missing encoding when logging from Makefile (#535)
* Fix missing encoding when logging from Makefile * Add comment explaining why stderr * Undo testing code
1 parent 28becaf commit b123bed

File tree

1 file changed

+11
-2
lines changed
  • aws_lambda_builders/workflows/custom_make

1 file changed

+11
-2
lines changed

aws_lambda_builders/workflows/custom_make/make.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import io
55
import logging
66
import shutil
7+
import sys
78
import threading
89

910
LOG = logging.getLogger(__name__)
@@ -92,9 +93,17 @@ def run(self, args, env=None, cwd=None):
9293

9394
# Log every stdout line by iterating
9495
for line in p.stdout:
95-
decoded_line = line.decode("utf-8").strip()
96-
LOG.info(decoded_line)
96+
# Writing to stderr instead of using LOG.info
97+
# since the logger library does not include ANSI
98+
# formatting characters in the output
99+
#
100+
# stderr is used since stdout appears to be reserved
101+
# for command responses
102+
sys.stderr.buffer.write(line)
103+
sys.stderr.flush()
104+
97105
# Gather total stdout
106+
decoded_line = line.decode("utf-8").strip()
98107
stdout += decoded_line
99108

100109
# Wait for the process to exit and stderr thread to end.

0 commit comments

Comments
 (0)