@u4/adbkit
Version:
A Typescript client for the Android Debug Bridge.
30 lines • 1.02 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const errors_1 = require("../../errors");
const command_1 = __importDefault(require("../../command"));
class IsInstalledCommand extends command_1.default {
async execute(pkg) {
await this._send(`shell:pm path ${pkg} 2>/dev/null`);
await this.readOKAY();
try {
const reply = await this.parser.readAscii(8);
switch (reply) {
case 'package:':
return true;
default:
throw this.parser.unexpected(reply, "'package:'");
}
}
catch (err) {
if (err instanceof errors_1.AdbPrematureEOFError) {
return false;
}
throw err;
}
}
}
exports.default = IsInstalledCommand;
//# sourceMappingURL=isinstalled.js.map