[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250625162237.3996-2-saivishnu725@gmail.com>
Date: Wed, 25 Jun 2025 21:52:35 +0530
From: Sai Vishnu M <saivishnu725@...il.com>
To: corbet@....net,
mchehab@...nel.org
Cc: linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org,
shuah@...nel.org,
Sai Vishnu M <saivishnu725@...il.com>
Subject: [PATCH 2/4] scripts: sphinx-pre-install: add a helper subroutine
From: Sai Vishnu M <saivishnu725@...il.com>
Implement run_if_interactive subroutine to prompt for command execution.
The script crashes if the command fails to execute properly.
Signed-off-by: Sai Vishnu M <saivishnu725@...il.com>
---
Patch series history:
1 -> implement the --interactive flag
scripts/sphinx-pre-install | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index 6e6e5bda6186..16eb739fd633 100755
--- a/scripts/sphinx-pre-install
+++ b/scripts/sphinx-pre-install
@@ -339,6 +339,22 @@ sub which($)
return undef;
}
+sub run_if_interactive($)
+{
+ my $command = shift;
+ printf("\n\t$command\n");
+
+ if ($interactive) {
+ printf("Run the command now? [Y/n]: ");
+ my $user_input = <STDIN>;
+ chomp $user_input;
+ if ($user_input eq '' or $user_input =~ /^y(es)?$/i) {
+ system($command) == 0
+ or die "Failed to run the command";
+ }
+ }
+}
+
#
# Subroutines that check distro-specific hints
#
--
2.49.0
Powered by blists - more mailing lists