diff -r 53e9422a9b45 -r 2e726c934fcd mercurial/ui.py --- a/mercurial/ui.py Tue May 31 21:16:17 2022 +0200 +++ b/mercurial/ui.py Tue May 31 22:50:01 2022 +0200 @@ -1517,8 +1517,8 @@ stderr=procutil.stderr, env=procutil.tonativeenv(procutil.shellenviron(env)), ) - except OSError as e: - if e.errno == errno.ENOENT and not shell: + except FileNotFoundError: + if not shell: self.warn( _(b"missing pager command '%s', skipping pager\n") % command )