Brief description
Running the CLI and piping the output to less leads to a BrokenPipeError if the user doesn't view all of the output content within the pager.
Expected behavior
CLI aborts emitting data and exits without error if not all content is viewed.
Actual behavior
Exception thrown:
$ sphobjinv co plain tests/resource/objects_yt.inv - | less -S
# ... View a portion of output then exit ...
Traceback (most recent call last):
File ".../bin/sphobjinv", line 7, in <module>
sys.exit(main())
~~~~^^
File ".../sphobjinv/src/sphobjinv/cli/core.py", line 95, in main
do_convert(inv, in_path, params)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File ".../sphobjinv/src/sphobjinv/cli/convert.py", line 71, in do_convert
write_stdout(inv, params)
~~~~~~~~~~~~^^^^^^^^^^^^^
File ".../sphobjinv/src/sphobjinv/cli/write.py", line 185, in write_stdout
print(
~~~~~^
inv.data_file(
^^^^^^^^^^^^^^
expand=params[PrsConst.EXPAND], contract=params[PrsConst.CONTRACT]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
).decode()
^^^^^^^^^^
)
System information
- Device: Windows 11
- OS: Debian WSL (13.2 trixie)
Python environment
Repros on 3.10, 3.13, 3.14, 3.14t
Brief description
Running the CLI and piping the output to
lessleads to aBrokenPipeErrorif the user doesn't view all of the output content within the pager.Expected behavior
CLI aborts emitting data and exits without error if not all content is viewed.
Actual behavior
Exception thrown:
System information
Python environment
Repros on 3.10, 3.13, 3.14, 3.14t