You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2013/02/06 17:51:33 UTC

[4/5] git commit: refs/heads/qemu-img - Remove redundant runSimpleBashScript code.

Remove redundant runSimpleBashScript code.

It can call itself with a timeout set to 0 since
the constructor will set that to the default timeout.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/cf17ff1d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/cf17ff1d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/cf17ff1d

Branch: refs/heads/qemu-img
Commit: cf17ff1d3524653e689a9ac4fe97583f4eebaef4
Parents: b73e858
Author: Wido den Hollander <wi...@widodh.nl>
Authored: Wed Feb 6 16:29:03 2013 +0100
Committer: Wido den Hollander <wi...@widodh.nl>
Committed: Wed Feb 6 16:29:03 2013 +0100

----------------------------------------------------------------------
 utils/src/com/cloud/utils/script/Script.java |   15 +--------------
 1 files changed, 1 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/cf17ff1d/utils/src/com/cloud/utils/script/Script.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/script/Script.java b/utils/src/com/cloud/utils/script/Script.java
index 9731ad1..32e4a6c 100755
--- a/utils/src/com/cloud/utils/script/Script.java
+++ b/utils/src/com/cloud/utils/script/Script.java
@@ -454,20 +454,7 @@ public class Script implements Callable<String> {
     }
 
     public static String runSimpleBashScript(String command) {
-
-        Script s = new Script("/bin/bash");
-        s.add("-c");
-        s.add(command);
-
-        OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser();
-        if (s.execute(parser) != null)
-            return null;
-
-        String result = parser.getLine();
-        if (result == null || result.trim().isEmpty())
-            return null;
-        else
-            return result.trim();
+        return Script.runSimpleBashScript(command, 0);
     }
     
     public static String runSimpleBashScript(String command, int timeout) {