From 0faf8959dbc4bd2175683939305e1926590d36ed Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Tue, 20 Mar 2018 16:25:08 -0400 Subject: Added an extra check to ppaged() to make sure cmd2 app is running in a real terminal before attempting to use a pager --- examples/paged_output.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'examples/paged_output.py') diff --git a/examples/paged_output.py b/examples/paged_output.py index 171c1b3e..9005a4da 100755 --- a/examples/paged_output.py +++ b/examples/paged_output.py @@ -17,6 +17,10 @@ class PagedOutput(cmd2.Cmd): @with_argument_list def do_page_file(self, args): """Read in a text file and display its output in a pager.""" + if not args: + self.perror('page_file requires a path to a file as an argument', traceback_war=False) + return + with open(args[0], 'r') as f: text = f.read() self.ppaged(text) -- cgit v1.2.1