This is an automated email from the ASF dual-hosted git repository.
shwstppr pushed a commit to branch 4.19
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.19 by this push:
new b080215c085 utils: honor custom timeout for script execution for exit
value
b080215c085 is described below
commit b080215c085545d6c13e6d642dbd65958e4106de
Author: Abhishek Kumar <[email protected]>
AuthorDate: Mon Jul 8 11:35:28 2024 +0530
utils: honor custom timeout for script execution for exit value
Signed-off-by: Abhishek Kumar <[email protected]>
---
utils/src/main/java/com/cloud/utils/script/Script.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/utils/src/main/java/com/cloud/utils/script/Script.java
b/utils/src/main/java/com/cloud/utils/script/Script.java
index 7aa037e7173..6cd622582be 100644
--- a/utils/src/main/java/com/cloud/utils/script/Script.java
+++ b/utils/src/main/java/com/cloud/utils/script/Script.java
@@ -660,8 +660,8 @@ public class Script implements Callable<String> {
return executable;
}
- private static Script getScriptForCommandRun(String... command) {
- Script s = new Script(command[0], 0);
+ private static Script getScriptForCommandRun(long timeout, String...
command) {
+ Script s = new Script(command[0], timeout);
if (command.length > 1) {
for (int i = 1; i < command.length; ++i) {
s.add(command[i]);
@@ -670,12 +670,16 @@ public class Script implements Callable<String> {
return s;
}
+ private static Script getScriptForCommandRun(String... command) {
+ return getScriptForCommandRun(0, command);
+ }
+
public static String executeCommand(String... command) {
return runScript(getScriptForCommandRun(command));
}
public static int executeCommandForExitValue(long timeout, String...
command) {
- return runScriptForExitValue(getScriptForCommandRun(command));
+ return runScriptForExitValue(getScriptForCommandRun(timeout, command));
}
public static int executeCommandForExitValue(String... command) {