diff --git a/lib/units/device/resources/minicap.js b/lib/units/device/resources/minicap.js index 1b342b19..d5b36914 100644 --- a/lib/units/device/resources/minicap.js +++ b/lib/units/device/resources/minicap.js @@ -4,6 +4,7 @@ var path = require('path') var Promise = require('bluebird') var syrup = require('@devicefarmer/stf-syrup') +var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default var logger = require('../../../util/logger') var pathutil = require('../../../util/pathutil') @@ -18,6 +19,7 @@ module.exports = syrup.serial() .dependency(require('../support/sdk')) .define(function(options, adb, properties, abi, sdk) { var log = logger.createLogger('device:resources:minicap') + var deviceClient = new DeviceClient(adb, options.serial) var resources = { bin: new Resource({ @@ -62,7 +64,7 @@ module.exports = syrup.serial() } function removeResource(res) { - return adb.shell(options.serial, ['rm', '-f', res.dest]) + return deviceClient.shell(options.serial, ['rm', '-f', res.dest]) .timeout(10000) .then(function(out) { return streamutil.readAll(out) @@ -71,7 +73,7 @@ module.exports = syrup.serial() } function pushResource(res) { - return adb.push(options.serial, res.src, res.dest, res.mode) + return deviceClient.push(options.serial, res.src, res.dest, res.mode) .timeout(10000) .then(function(transfer) { return new Promise(function(resolve, reject) { @@ -86,7 +88,7 @@ module.exports = syrup.serial() log.info('Installing "%s" as "%s"', res.src, res.dest) function checkExecutable(res) { - return adb.stat(options.serial, res.dest) + return deviceClient.stat(options.serial, res.dest) .timeout(5000) .then(function(stats) { // Can't use fs.constants.S_IXUSR due to differences on Windows. @@ -136,7 +138,7 @@ module.exports = syrup.serial() bin: resources.bin.dest , lib: resources.lib.dest , run: function(cmd) { - return adb.shell(options.serial, util.format( + return deviceClient.shell(options.serial, util.format( 'LD_LIBRARY_PATH=%s exec %s %s' , path.dirname(resources.lib.dest) , resources.bin.dest