File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -151,12 +151,19 @@ def main() -> None:
151151 histfile = os .path .expanduser ("~/.drgn_history" )
152152 try :
153153 readline .read_history_file (histfile )
154- except FileNotFoundError :
155- pass
156- readline .parse_and_bind ("tab: complete" )
157- readline .set_history_length (1000 )
158- atexit .register (readline .write_history_file , histfile )
154+ except OSError as e :
155+ if not isinstance (e , FileNotFoundError ) and not args .quiet :
156+ print ('could not read history:' , str (e ), file = sys .stderr )
157+ def write_history_file ():
158+ try :
159+ readline .write_history_file (histfile )
160+ except OSError as e :
161+ if not args .quiet :
162+ print ('could not write history:' , str (e ), file = sys .stderr )
163+ atexit .register (write_history_file )
159164
165+ readline .set_history_length (1000 )
166+ readline .parse_and_bind ("tab: complete" )
160167 readline .set_completer (Completer (init_globals ).complete )
161168 atexit .register (lambda : readline .set_completer (None ))
162169
You can’t perform that action at this time.
0 commit comments