INNER CODE UNIT · Python
set_sigpipe_handler
tskit-dev/tskit · python/tskit/cli.py:37
def set_sigpipe_handler():
if os.name == "posix":
# Set signal handler for SIGPIPE to quietly kill the program.
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
def sys_exit(message):
sys.exit(message)
def load_tree_sequence(path):
if path is None:
path = sys.stdin
try:
return tskit.load(path)
except (OSError, EOFError, tskit.FileFormatError) as e:
sys_exit(f"Load error: {e}")