Skip to content

Commit c45322e

Browse files
mmaengkddejong
andauthored
chore(log): format log output from build job (#81)
* Update build command to output text instead of binary for correct formatting of stdout and stderr * Update tests to account for newlines Co-authored-by: Kevin DeJong <[email protected]>
1 parent ccaa200 commit c45322e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

python/rpdk/typescript/codegen.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def _remove_build_artifacts(deps_path):
235235
@staticmethod
236236
def _make_build_command(base_path, build_command=None):
237237
command = (
238-
"npm install --optional "
238+
"npm install --include=optional "
239239
+ f"&& sam build --debug --build-dir {os.path.join(base_path, 'build')}"
240240
)
241241
if build_command is not None:
@@ -268,6 +268,7 @@ def _build(self, base_path):
268268
stderr=PIPE,
269269
cwd=base_path,
270270
check=True,
271+
universal_newlines=True,
271272
)
272273
else: # pragma: no cover
273274
# On all other OS use default shell in subprocess to run build command
@@ -278,6 +279,7 @@ def _build(self, base_path):
278279
cwd=base_path,
279280
check=True,
280281
shell=True,
282+
universal_newlines=True,
281283
)
282284

283285
except (FileNotFoundError, CalledProcessError) as e:

tests/plugin/codegen_test.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# pylint: disable=redefined-outer-name,protected-access
2+
from __future__ import unicode_literals
3+
24
import os
35
import sys
46
from subprocess import CalledProcessError
@@ -197,6 +199,7 @@ def test__build_docker(plugin: TypescriptLanguagePlugin):
197199
cwd=sentinel.base_path,
198200
stderr=-1,
199201
stdout=-1,
202+
universal_newlines=True,
200203
)
201204
else:
202205
mock_subprocess_run.assert_called_once_with(
@@ -206,4 +209,5 @@ def test__build_docker(plugin: TypescriptLanguagePlugin):
206209
stderr=-1,
207210
stdout=-1,
208211
shell=True,
212+
universal_newlines=True,
209213
)

0 commit comments

Comments
 (0)