Skip to content

Commit

Permalink
Terminate --allow-only and --fail-on messages with a newline
Browse files Browse the repository at this point in the history
  • Loading branch information
raimon49 committed Sep 20, 2023
1 parent c1d5e6c commit 629a433
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions piplicenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def get_python_sys_path(executable: str) -> list[str]:
if failed_licenses:
sys.stderr.write(
"fail-on license {} was found for package "
"{}:{}".format(
"{}:{}\n".format(
"; ".join(sorted(failed_licenses)),
pkg_info["name"],
pkg_info["version"],
Expand All @@ -337,7 +337,7 @@ def get_python_sys_path(executable: str) -> list[str]:
if len(uncommon_licenses) == len(license_names):
sys.stderr.write(
"license {} not in allow-only licenses was found"
" for package {}:{}".format(
" for package {}:{}\n".format(
"; ".join(sorted(uncommon_licenses)),
pkg_info["name"],
pkg_info["version"],
Expand Down Expand Up @@ -1079,6 +1079,10 @@ def save_if_needs(output_file: None | str, output_string: str) -> None:
try:
with open(output_file, "w", encoding="utf-8") as f:
f.write(output_string)
if not output_string.endswith("\n"):
# Always end output files with a new line
f.write("\n")

sys.stdout.write("created path: " + output_file + "\n")
sys.exit(0)
except IOError:
Expand Down

0 comments on commit 629a433

Please sign in to comment.