mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Handle broken pipes in arc_summary
Using a command similar to 'arc_summary.py | head' causes a broken pipe exception. Gracefully exit in the case of a broken pipe in arc_summary.py. Reviewed-by: Richard Elling <Richard.Elling@RichardElling.com> Reviewed-by: loli10K <ezomori.nozomu@gmail.com> Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov> Closes #6965 Closes #6969
This commit is contained in:
committed by
Tony Hutter
parent
9a6c57845a
commit
c2aacf2087
@@ -47,6 +47,7 @@ import getopt
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import errno
|
||||
|
||||
from subprocess import Popen, PIPE
|
||||
from decimal import Decimal as D
|
||||
@@ -55,6 +56,18 @@ show_tunable_descriptions = False
|
||||
alternate_tunable_layout = False
|
||||
|
||||
|
||||
def handle_Exception(ex_cls, ex, tb):
|
||||
if ex is IOError:
|
||||
if ex.errno == errno.EPIPE:
|
||||
sys.exit()
|
||||
|
||||
if ex is KeyboardInterrupt:
|
||||
sys.exit()
|
||||
|
||||
|
||||
sys.excepthook = handle_Exception
|
||||
|
||||
|
||||
def get_Kstat():
|
||||
"""Collect information on the ZFS subsystem from the /proc virtual
|
||||
file system. The name "kstat" is a holdover from the Solaris utility
|
||||
|
||||
Reference in New Issue
Block a user