aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Mentz <danielmentz@google.com>2019-03-28 18:12:30 -0700
committerDaniel Mentz <danielmentz@google.com>2019-03-29 15:17:48 -0700
commitbb4cf7b8a7d515faedc651b318755634be00312d (patch)
treec097293a7d32812038111e1ab4b214c0a0f061c1
parentb95c8af8c97dd34454bdf6092cc5e09efe9888ce (diff)
downloadandroid_bionic-bb4cf7b8a7d515faedc651b318755634be00312d.tar.gz
android_bionic-bb4cf7b8a7d515faedc651b318755634be00312d.tar.bz2
android_bionic-bb4cf7b8a7d515faedc651b318755634be00312d.zip
clean_header: Don't print extraneous newline char
Don't print an extraneous newline character at the end of the include file if clean_header.py is used in the non-update mode. This is necessary to achieve consistent results in the update and non-update modes. Running clean_header in the non-update mode and redirecting the output to a file should have the same result as using the update mode and have the script write to the file directly. Change-Id: I6b176c5365840d66e4499bacd205f1fa77302a2b
-rwxr-xr-xlibc/kernel/tools/clean_header.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/libc/kernel/tools/clean_header.py b/libc/kernel/tools/clean_header.py
index 072ca1a91..b79c9b690 100755
--- a/libc/kernel/tools/clean_header.py
+++ b/libc/kernel/tools/clean_header.py
@@ -172,7 +172,12 @@ if __name__ == "__main__":
dst_file = os.path.join(dst_dir, path)
src_file = os.path.join(src_dir, path)
new_data = cleanupFile(dst_file, src_file, path)
- print new_data
+ # Use sys.stdout.write instead of a simple print statement to avoid
+ # sending an extra new line character to stdout. Running this
+ # program in non-update mode and redirecting stdout to a file should
+ # yield the same result as using update mode, where new_data is
+ # written directly to a file.
+ sys.stdout.write(new_data)
sys.exit(0)