Don't capture stderr, this will return an error when the runscript command expects null when there is no default route.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/79536601 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/79536601 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/79536601 Branch: refs/heads/ui-restyle Commit: 795366019b4dfcc0f86ed813a07c8ae2ac28fa33 Parents: 71dc43e Author: Hugo Trippaers <htrippa...@schubergphilis.com> Authored: Mon Oct 14 09:58:37 2013 +0200 Committer: Hugo Trippaers <htrippa...@schubergphilis.com> Committed: Mon Oct 14 09:58:37 2013 +0200 ---------------------------------------------------------------------- utils/src/com/cloud/utils/net/NetUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/79536601/utils/src/com/cloud/utils/net/NetUtils.java ---------------------------------------------------------------------- diff --git a/utils/src/com/cloud/utils/net/NetUtils.java b/utils/src/com/cloud/utils/net/NetUtils.java index 1e72e22..e64af4c 100755 --- a/utils/src/com/cloud/utils/net/NetUtils.java +++ b/utils/src/com/cloud/utils/net/NetUtils.java @@ -199,7 +199,7 @@ public class NetUtils { public static String getDefaultEthDevice() { if (SystemUtils.IS_OS_MAC) { - String defDev = Script.runSimpleBashScript("/sbin/route -n get default | grep interface | awk '{print $2}'"); + String defDev = Script.runSimpleBashScript("/sbin/route -n get default 2> /dev/null | grep interface | awk '{print $2}'"); return defDev; } String defaultRoute = Script.runSimpleBashScript("/sbin/route | grep default");