On 11/17/2014 11:23 AM, Chuck Lever wrote: > When running mountstats under "watch," occassionally the output > shows "close failed in file object desctructor: sys.excepthook is > missing" and the data display is messed up. This seems to be a > common problem when Python script output is piped to another > program. > > Ensure stdout/stderr is completely flushed before mountstats exits, > and add an IOError exception handler to catch these exceptions > gracefully. > > Solution suggested by: http://bugs.python.org/issue11380 > > Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx> Committed... steved. > --- > tools/mountstats/mountstats.py | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/tools/mountstats/mountstats.py b/tools/mountstats/mountstats.py > index 9a6ec43..e6a456c 100644 > --- a/tools/mountstats/mountstats.py > +++ b/tools/mountstats/mountstats.py > @@ -612,8 +612,12 @@ try: > nfsstat_command() > elif prog == 'ms-iostat': > iostat_command() > + sys.stdout.close() > + sys.stderr.close() > except KeyboardInterrupt: > print('Caught ^C... exiting') > sys.exit(1) > +except IOError: > + pass > > sys.exit(0) > -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html