catch IOError when writing .mininet_history (#1031)

write_history seems to raise a spurious IOError,
so we catch it.
This commit is contained in:
lantz
2021-02-07 19:12:38 -08:00
committed by GitHub
parent 6b90434b9c
commit 5d4ec1ab9e
+9 -1
View File
@@ -89,7 +89,15 @@ class CLI( Cmd ):
if os.path.isfile( history_path ):
read_history_file( history_path )
set_history_length( 1000 )
atexit.register( lambda: write_history_file( history_path ) )
def writeHistory():
"Write out history file"
try:
write_history_file( history_path )
except IOError:
# Ignore probably spurious IOError
pass
atexit.register( writeHistory )
def run( self ):
"Run our cmdloop(), catching KeyboardInterrupt"