mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-19 00:33:30 +02:00
Replace device:support:quit with util:lifecycle, which is usable by non-device processes too.
This commit is contained in:
@@ -6,13 +6,13 @@ var monkey = require('adbkit-monkey')
|
||||
var wire = require('../../../wire')
|
||||
var devutil = require('../../../util/devutil')
|
||||
var logger = require('../../../util/logger')
|
||||
var lifecycle = require('../../../util/lifecycle')
|
||||
|
||||
module.exports = syrup.serial()
|
||||
.dependency(require('../support/adb'))
|
||||
.dependency(require('../support/router'))
|
||||
.dependency(require('../support/quit'))
|
||||
.dependency(require('../resources/remote'))
|
||||
.define(function(options, adb, router, quit, remote) {
|
||||
.define(function(options, adb, router, remote) {
|
||||
var log = logger.createLogger('device:plugins:touch')
|
||||
|
||||
var service = {
|
||||
@@ -30,18 +30,11 @@ module.exports = syrup.serial()
|
||||
])
|
||||
})
|
||||
.then(function(out) {
|
||||
lifecycle.share('Touch remote shell', out)
|
||||
out.pipe(split())
|
||||
.on('data', function(chunk) {
|
||||
log.info('Remote says: "%s"', chunk)
|
||||
})
|
||||
.on('error', function(err) {
|
||||
log.fatal('Remote had an error', err.stack)
|
||||
quit.fatal()
|
||||
})
|
||||
.on('end', function() {
|
||||
log.fatal('Remote ended')
|
||||
quit.fatal()
|
||||
})
|
||||
})
|
||||
.then(function() {
|
||||
return devutil.waitForPort(adb, options.serial, service.port)
|
||||
@@ -50,15 +43,7 @@ module.exports = syrup.serial()
|
||||
return Promise.promisifyAll(monkey.connectStream(conn))
|
||||
})
|
||||
.then(function(monkey) {
|
||||
return monkey
|
||||
.on('error', function(err) {
|
||||
log.fatal('Monkey had an error', err.stack)
|
||||
quit.fatal()
|
||||
})
|
||||
.on('end', function() {
|
||||
log.fatal('Monkey ended')
|
||||
quit.fatal()
|
||||
})
|
||||
return lifecycle.share('Touch monkey', monkey)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user