Fix adb invocations (#202)

This commit is contained in:
Karol Wrótniak
2021-03-10 14:50:33 +01:00
committed by GitHub
parent 50ee38c2ce
commit 5dfdd9ac63
18 changed files with 79 additions and 43 deletions

View File

@@ -1,6 +1,7 @@
var syrup = require('@devicefarmer/stf-syrup')
var path = require('path')
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
var logger = require('../../../util/logger')
var wire = require('../../../wire')
var wireutil = require('../../../wire/util')
@@ -11,15 +12,16 @@ module.exports = syrup.serial()
.dependency(require('../support/push'))
.dependency(require('../support/storage'))
.define(function(options, adb, router, push, storage) {
var deviceClient = new DeviceClient(adb, options.serial)
var log = logger.createLogger('device:plugins:filesystem')
var plugin = Object.create(null)
plugin.retrieve = function(file) {
log.info('Retrieving file "%s"', file)
return adb.stat(options.serial, file)
return deviceClient.stat(file)
.then(function(stats) {
return adb.pull(options.serial, file)
return deviceClient.pull(file)
.then(function(transfer) {
// We may have add new storage plugins for various file types
// in the future, and add proper detection for the mimetype.
@@ -54,7 +56,7 @@ module.exports = syrup.serial()
router.on(wire.FileSystemListMessage, function(channel, message) {
var reply = wireutil.reply(options.serial)
adb.readdir(options.serial, message.dir)
deviceClient.readdir(message.dir)
.then(function(files) {
push.send([
channel