From f603189dbe697b663f66a1d1e432f7c1aa1ed115 Mon Sep 17 00:00:00 2001
From: Tomas Volf <~@wolfsden.cz>
Date: Mon, 2 Sep 2024 14:10:45 +0200
Subject: [PATCH] help: Support empty PAGER.

* awscli/help.py (PosixHelpRenderer._send_output_to_pager): Support empty PAGER.
---
 awscli/help.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff -ru aws-cli-2.31.22-orig/awscli/help.py aws-cli-2.31.22/awscli/help.py
--- a/awscli/help.py	2025-10-24 16:04:43.684360202 -0400
+++ b/awscli/help.py	2025-10-24 16:11:17.755353159 -0400
@@ -198,9 +198,10 @@

     def _send_output_to_pager(self, output):
         cmdline = self.get_pager_cmdline()
-        if not self._exists_on_path(cmdline[0]):
+        if not (cmdline and self._exists_on_path(cmdline[0])):
+            pager = cmdline[0] if cmdline else "<empty>"
             LOG.debug(
-                f"Pager '{cmdline[0]}' not found in PATH, printing raw help."
+                f"Pager '{pager}' not found in PATH, printing raw help."
             )
             self.output_stream.write(output.decode('utf-8') + "\n")
             self.output_stream.flush()
