mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 04:53:19 +02:00
Fix adb invocations (#202)
This commit is contained in:
@@ -6,6 +6,7 @@ var adbkit = require('@devicefarmer/adbkit')
|
||||
var logger = require('../../../../util/logger')
|
||||
var wire = require('../../../../wire')
|
||||
var wireutil = require('../../../../wire/util')
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
|
||||
module.exports = syrup.serial()
|
||||
.dependency(require('../../support/adb'))
|
||||
@@ -15,6 +16,7 @@ module.exports = syrup.serial()
|
||||
.dependency(require('../../resources/minicap'))
|
||||
.dependency(require('../util/display'))
|
||||
.define(function(options, adb, router, push, storage, minicap, display) {
|
||||
var deviceClient = new DeviceClient(adb, options.serial)
|
||||
var log = logger.createLogger('device:plugins:screen:capture')
|
||||
var plugin = Object.create(null)
|
||||
|
||||
@@ -37,14 +39,14 @@ module.exports = syrup.serial()
|
||||
'-P %s -s >%s', projectionFormat(), file))
|
||||
.then(adbkit.util.readAll)
|
||||
.then(function() {
|
||||
return adb.stat(options.serial, file)
|
||||
return deviceClient.stat(file)
|
||||
})
|
||||
.then(function(stats) {
|
||||
if (stats.size === 0) {
|
||||
throw new Error('Empty screenshot; possibly secure screen?')
|
||||
}
|
||||
|
||||
return adb.pull(options.serial, file)
|
||||
return deviceClient.pull(file)
|
||||
.then(function(transfer) {
|
||||
return storage.store('image', transfer, {
|
||||
filename: util.format('%s.jpg', options.serial)
|
||||
@@ -54,7 +56,7 @@ module.exports = syrup.serial()
|
||||
})
|
||||
})
|
||||
.finally(function() {
|
||||
return adb.shell(options.serial, ['rm', '-f', file])
|
||||
return deviceClient.shell(['rm', '-f', file])
|
||||
.then(adbkit.util.readAll)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user