mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
pager: catch startup failures on Windows
If the user's pager settings are broken, display an error message rather than crash to avoid confusing them. Bug: https://crbug.com/gerrit/16173 Change-Id: Idc0891da783c68f3a96ac53a82781e34e40421fb Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/343437 Reviewed-by: LaMont Jones <lamontjones@google.com> Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
7fa8eedd8f
commit
3c2d807905
7
pager.py
7
pager.py
@ -56,8 +56,11 @@ def _PipePager(pager):
|
||||
global pager_process, old_stdout, old_stderr
|
||||
assert pager_process is None, "Only one active pager process at a time"
|
||||
# Create pager process, piping stdout/err into its stdin
|
||||
pager_process = subprocess.Popen([pager], stdin=subprocess.PIPE, stdout=sys.stdout,
|
||||
stderr=sys.stderr)
|
||||
try:
|
||||
pager_process = subprocess.Popen([pager], stdin=subprocess.PIPE, stdout=sys.stdout,
|
||||
stderr=sys.stderr)
|
||||
except FileNotFoundError:
|
||||
sys.exit(f'fatal: cannot start pager "{pager}"')
|
||||
old_stdout = sys.stdout
|
||||
old_stderr = sys.stderr
|
||||
sys.stdout = pager_process.stdin
|
||||
|
Loading…
Reference in New Issue
Block a user