mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 16:13:24 +02:00
Replace device:support:quit with util:lifecycle, which is usable by non-device processes too.
This commit is contained in:
@@ -11,14 +11,14 @@ var keyutil = require('../../../util/keyutil')
|
||||
var streamutil = require('../../../util/streamutil')
|
||||
var logger = require('../../../util/logger')
|
||||
var ms = require('../../../wire/messagestream')
|
||||
var lifecycle = require('../../../util/lifecycle')
|
||||
|
||||
module.exports = syrup.serial()
|
||||
.dependency(require('../support/adb'))
|
||||
.dependency(require('../support/router'))
|
||||
.dependency(require('../support/push'))
|
||||
.dependency(require('../support/quit'))
|
||||
.dependency(require('../resources/service'))
|
||||
.define(function(options, adb, router, push, quit, apk) {
|
||||
.define(function(options, adb, router, push, apk) {
|
||||
var log = logger.createLogger('device:plugins:input')
|
||||
var serviceQueue = []
|
||||
|
||||
@@ -49,18 +49,11 @@ module.exports = syrup.serial()
|
||||
))
|
||||
})
|
||||
.then(function(out) {
|
||||
lifecycle.share('InputAgent shell', out)
|
||||
out.pipe(split())
|
||||
.on('data', function(chunk) {
|
||||
log.info('Agent says: "%s"', chunk)
|
||||
})
|
||||
.on('error', function(err) {
|
||||
log.fatal('InputAgent shell had an error', err.stack)
|
||||
quit.fatal()
|
||||
})
|
||||
.on('end', function() {
|
||||
log.fatal('InputAgent shell ended')
|
||||
quit.fatal()
|
||||
})
|
||||
})
|
||||
.then(function() {
|
||||
return devutil.waitForPort(adb, options.serial, agent.port)
|
||||
@@ -69,14 +62,7 @@ module.exports = syrup.serial()
|
||||
agent.socket = conn
|
||||
agent.writer = new ms.DelimitingStream()
|
||||
agent.writer.pipe(conn)
|
||||
conn.on('error', function(err) {
|
||||
log.fatal('InputAgent socket had an error', err.stack)
|
||||
quit.fatal()
|
||||
})
|
||||
conn.on('end', function() {
|
||||
log.fatal('InputAgent socket ended')
|
||||
quit.fatal()
|
||||
})
|
||||
lifecycle.share('InputAgent connection', conn)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -160,14 +146,7 @@ module.exports = syrup.serial()
|
||||
})
|
||||
service.writer = new ms.DelimitingStream()
|
||||
service.writer.pipe(conn)
|
||||
conn.on('error', function(err) {
|
||||
log.fatal('InputService socket had an error', err.stack)
|
||||
quit.fatal()
|
||||
})
|
||||
.on('end', function() {
|
||||
log.fatal('InputService socket ended')
|
||||
quit.fatal()
|
||||
})
|
||||
lifecycle.share('InputService connection', conn)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user