diff --git a/lib/adb.js b/lib/adb.js index d2e9c96..fb7c3ce 100644 --- a/lib/adb.js +++ b/lib/adb.js @@ -36,15 +36,23 @@ function ADBObject() { }; this.getProperty = function(id, name) { - return SHELL.exec([this.binPath, "-s", id, "shell", "getprop", name]); + return this.sendShell(id, ["getprop", name]); }; this.disableService = function(id, name) { - return SHELL.exec([this.binPath, "-s", id, "shell", "svc", name, "disable"]); + return this.sendShell(id, ["svc", name, "disable"]); }; this.enableService = function(id, name) { - return SHELL.exec([this.binPath, "-s", id, "shell", "svc", name, "enable"]); + return this.sendShell(id, ["svc", name, "enable"]); + }; + + this.sendShell = function(id, args) { + try { + return SHELL.exec([this.binPath, "-s", id, "shell"].concat(args)); + } catch (e) { + return ""; + } }; } @@ -52,6 +60,6 @@ exports.create = function() { return new ADBObject(); }; -exports.VERSIONINFO = "Android Debug Bridge Interface (adb.js) version 0.1"; +exports.VERSIONINFO = "Android Debug Bridge Interface (adb.js) version 0.2"; exports.global = global; exports.require = global.require;