Handle ctrl-c while paging help gracefully
This commit is contained in:
parent
222beedc2a
commit
8d9ba4a772
@ -275,7 +275,10 @@ def print_help_for_seq(seq, usage, message, appname):
|
||||
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…
x
Reference in New Issue
Block a user