提交 8dce2d5d 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

code clean

上级 09f88e78
......@@ -4,7 +4,7 @@
## Connecting ChatBots.
Wechaty is a Bot Framework for Wechat **Personal** Account that helps you easy creating bot in 6 lines of javascript, with cross-platform support include [Linux](https://travis-ci.org/wechaty/wechaty), [Windows](https://ci.appveyor.com/project/wechaty/wechaty), [Darwin(OSX/Mac)](https://travis-ci.org/wechaty/wechaty) and [Docker](https://circleci.com/gh/wechaty/wechaty).
Wechaty is a Bot Framework for Wechat **Personal** Account which can help you create a bot in 6 lines of javascript by easy to use API, with cross-platform support include [Linux](https://travis-ci.org/wechaty/wechaty), [Windows](https://ci.appveyor.com/project/wechaty/wechaty), [Darwin(OSX/Mac)](https://travis-ci.org/wechaty/wechaty) and [Docker](https://circleci.com/gh/wechaty/wechaty).
[![Join the chat at https://gitter.im/zixia/wechaty](https://badges.gitter.im/zixia/wechaty.svg)](https://gitter.im/zixia/wechaty?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![node](https://img.shields.io/node/v/wechaty.svg?maxAge=604800)](https://nodejs.org/) [![Repo Size](https://reposs.herokuapp.com/?path=wechaty/wechaty)](https://github.com/wechaty/wechaty)
......
......@@ -282,9 +282,13 @@ export class Browser extends EventEmitter {
let matchRegex = new RegExp(browserRe, 'i')
const pids: number[] = children.filter(child => {
log.silly('PuppetWebBrowser', 'getBrowserPids() child: %s', JSON.stringify(child))
// https://github.com/indexzero/ps-tree/issues/18
return matchRegex.test('' + child.COMMAND + child.COMM)
if (matchRegex.test('' + child.COMMAND + child.COMM)) {
log.silly('PuppetWebBrowser', 'getBrowserPids() child: %s', JSON.stringify(child))
return true
}
return false
}).map(child => child.PID)
/**
......
......@@ -84,12 +84,15 @@ function onFeed(this: PuppetWeb, food: WatchdogFood): void {
function clearWatchDogTimer() {
if (!this.watchDogTimer) {
log.verbose('PuppetWebWatchdog', 'clearWatchDogTimer() nothing to clear')
return
}
clearTimeout(this.watchDogTimer)
this.watchDogTimer = null
const timeLeft = this.watchDogTimerTime - Date.now()
log.silly('PuppetWebWatchdog', 'clearWatchDogTimer() [%d] seconds left', Math.ceil(timeLeft / 1000))
if (this.watchDogTimerTime) {
const timeLeft = this.watchDogTimerTime - Date.now()
log.silly('PuppetWebWatchdog', 'clearWatchDogTimer() [%d] seconds left', Math.ceil(timeLeft / 1000))
}
}
function setWatchDogTimer(this: PuppetWeb, timeout, feed) {
......
......@@ -41,7 +41,7 @@ export class StateMonitor <A, B>{
)
this._target = newState
} else {
log.silly('StateMonitor', '%s:target() %s', this._client, this._target)
log.silly('StateMonitor', '%s:target() - %s', this._client, this._target)
}
return this._target
}
......@@ -89,7 +89,7 @@ export class StateMonitor <A, B>{
this._current = newState
this._stable = stable
} else {
log.silly('StateMonitor', '%s:current() %s', this._client, this._current)
log.silly('StateMonitor', '%s:current() - %s', this._client, this._current)
}
return this._current
}
......
......@@ -8,14 +8,12 @@
import { test } from 'ava'
import {
Config
, log
Config,
log,
} from '../../src/config'
// import { Message } from '../../src/message'
import { PuppetWeb } from '../../src/puppet-web'
import {
Server
} from '../../src/puppet-web/server'
import { Server } from '../../src/puppet-web/server'
// import { spy } from 'sinon'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册