Handle ctrl-c while paging help gracefully
This commit is contained in:
parent
222beedc2a
commit
8d9ba4a772
1 changed files with 4 additions and 1 deletions
|
|
@ -275,7 +275,10 @@ def wa(text, indent=0, leading_indent=None):
|
|||
if print_help_for_seq.allow_pager and sys.stdout.isatty():
|
||||
import subprocess
|
||||
p = subprocess.Popen(['less', '-isRXF'], stdin=subprocess.PIPE)
|
||||
p.communicate(text.encode('utf-8'))
|
||||
try:
|
||||
p.communicate(text.encode('utf-8'))
|
||||
except KeyboardInterrupt:
|
||||
raise SystemExit(1)
|
||||
raise SystemExit(p.wait())
|
||||
else:
|
||||
print(text)
|
||||
|
|
|
|||
Loading…
Reference in a new issue