Added timeout to uninstallApk

This commit is contained in:
sebv
2014-03-11 21:46:26 +08:00
parent f61a321d2e
commit be6f77b354
+8 -3
View File
@@ -131,13 +131,18 @@ ADB.prototype.checkAaptPresent = function (cb) {
this.checkSdkBinaryPresent("aapt", cb);
};
ADB.prototype.exec = function (cmd, cb) {
ADB.prototype.exec = function (cmd, opts, cb) {
if (!cb && typeof opts === 'function') {
cb = opts;
opts = {};
}
if (!cmd) {
return cb(new Error("You need to pass in a command to exec()"));
}
cmd = this.adbCmd + ' ' + cmd;
logger.debug("executing: " + cmd);
exec(cmd, {maxBuffer: 524288}, function (err, stdout, stderr) {
opts = _.defaults(opts, {maxBuffer: 524288});
exec(cmd, opts, function (err, stdout, stderr) {
if (err) logger.warn(err);
cb(err, stdout, stderr);
});
@@ -1064,7 +1069,7 @@ ADB.prototype.waitForNotActivity = function (pkg, act, waitMs, cb) {
ADB.prototype.uninstallApk = function (pkg, cb) {
logger.info("Uninstalling " + pkg);
this.exec("uninstall " + pkg, function (err, stdout) {
this.exec("uninstall " + pkg, {timeout: 20000}, function (err, stdout) {
if (err) {
logger.error(err);
cb(err);