Skip to content

Commit 1ba16ce

Browse files
authored
Fixed error output decoding. (#251)
1 parent 3a2542d commit 1ba16ce

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

fastapi_template/template/hooks/post_gen_project.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ def run_cmd(cmd: str, ignore_error: bool = False):
7777
"However, the project was generated. So it could be a false-positive.",
7878
"yellow",
7979
)
80-
cprint(out.stdout.decode(), "red")
81-
cprint(out.stderr.decode(), "red")
80+
if out.stdout:
81+
cprint(out.stdout.decode(errors="replace"), "red")
82+
if out.stderr:
83+
cprint(out.stderr.decode(errors="replace"), "red")
8284
exit(1)
8385

8486

0 commit comments

Comments
 (0)