File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -3684,15 +3684,20 @@ def do_shortcuts(self, _: argparse.Namespace) -> None:
36843684 eof_parser = DEFAULT_ARGUMENT_PARSER (description = "Called when Ctrl-D is pressed" , epilog = INTERNAL_COMMAND_EPILOG )
36853685
36863686 @with_argparser (eof_parser )
3687- def do_eof (self , _ : argparse .Namespace ) -> bool :
3688- """Called when Ctrl-D is pressed"""
3689- # Return True to stop the command loop
3690- return True
3687+ def do_eof (self , _ : argparse .Namespace ) -> Optional [bool ]:
3688+ """
3689+ Called when Ctrl-D is pressed and calls quit with no arguments.
3690+ This can be overridden if quit should be called differently.
3691+ """
3692+ self .poutput ()
3693+
3694+ # noinspection PyTypeChecker
3695+ return self .do_quit ('' )
36913696
36923697 quit_parser = DEFAULT_ARGUMENT_PARSER (description = "Exit this application" )
36933698
36943699 @with_argparser (quit_parser )
3695- def do_quit (self , _ : argparse .Namespace ) -> bool :
3700+ def do_quit (self , _ : argparse .Namespace ) -> Optional [ bool ] :
36963701 """Exit this application"""
36973702 # Return True to stop the command loop
36983703 return True
Original file line number Diff line number Diff line change @@ -972,7 +972,7 @@ def test_ctrl_c_at_prompt(say_app):
972972
973973 # And verify the expected output to stdout
974974 out = say_app .stdout .getvalue ()
975- assert out == 'hello\n ^C\n goodbye\n '
975+ assert out == 'hello\n ^C\n goodbye\n \n '
976976
977977
978978class ShellApp (cmd2 .Cmd ):
You can’t perform that action at this time.
0 commit comments