mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
utils: honor custom timeout for script execution for exit value
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
parent
d99cf93d7c
commit
b080215c08
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user