summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2021-05-27 21:43:07 -0700
committerTim Burke <tim.burke@gmail.com>2021-05-27 21:54:45 -0700
commit48f7881ab24e5acfb4d16c4bb6137b918b8a9393 (patch)
tree701a8f09c82edfbb9f504b00dd71d5a461cf717a
parent6cad60fd562ce3716d8cfb18bbdf3bf46639c348 (diff)
downloadxattr-48f7881ab24e5acfb4d16c4bb6137b918b8a9393.tar.gz
tool: Be willing to dump for -p like we do for -l
This both side-steps the stdout buffer flushing issue and prevents ambiguities where terminals don't display NUL.
-rwxr-xr-xxattr/tool.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/xattr/tool.py b/xattr/tool.py
index 5bc4000..ac12654 100755
--- a/xattr/tool.py
+++ b/xattr/tool.py
@@ -222,10 +222,9 @@ def main():
else:
if read:
if should_dump:
- print(file_prefix, end="")
- sys.stdout.flush()
- with os.fdopen(sys.stdout.fileno(), 'wb', closefd=False) as fp:
- fp.write(attr_value.encode('latin-1') + b'\n')
+ if file_prefix:
+ print(file_prefix)
+ print(_dump(attr_value))
else:
print("".join((file_prefix, attr_value)))
else: