Skip to content

Commit

Permalink
CLI: catch broken pipe errors
Browse files Browse the repository at this point in the history
  • Loading branch information
p-l- committed Apr 28, 2020
1 parent 9cb1786 commit cb96efc
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions bin/ivre
@@ -1,7 +1,7 @@
#! /usr/bin/env python

# This file is part of IVRE.
# Copyright 2011 - 2017 Pierre LALET <pierre.lalet@cea.fr>
# Copyright 2011 - 2020 Pierre LALET <pierre@droids-corp.org>
#
# IVRE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
Expand All @@ -20,8 +20,9 @@
"""IVRE command line"""


import sys
from errno import EPIPE
import os
import sys
import warnings


Expand Down Expand Up @@ -81,8 +82,12 @@ def main():
output.write(" %s\n" % availcmd)
output.write("\n")
output.write("Try %s help [COMMAND]\n\n" % executable)
exit(retcode)
sys.exit(retcode)


if __name__ == "__main__":
main()
try:
main()
except IOError as exc:
if exc.errno != EPIPE:
raise

0 comments on commit cb96efc

Please sign in to comment.