| 29 | }; |
| 30 | |
| 31 | function startWeinreServer(port) { |
| 32 | var weinreServer = weinre.run({ |
| 33 | httpPort: port, |
| 34 | boundHost: '-all-', |
| 35 | verbose: false, |
| 36 | debug: false, |
| 37 | readTimeout: 5, |
| 38 | deathTimeout: 15 |
| 39 | }); |
| 40 | weinreServer.on('listening', function () { |
| 41 | // auto open debugger page |
| 42 | if (!/window/i.test(process.platform)) { |
| 43 | child_process.exec('open http://127.0.0.1:' + port + '/client'); |
| 44 | } else { |
| 45 | child_process.exec('start http://127.0.0.1:' + port + '/client'); |
| 46 | } |
| 47 | new SpyProxy({ |
| 48 | weinewPort: port, |
| 49 | port: spyProxyPort |
| 50 | }); |
| 51 | console.log(logColor.FgGreen + '%s' + logColor.Reset, '浏览器打开 ---> http://127.0.0.1:' + port + '/client'); |
| 52 | }); |
| 53 | weinreServer.on('error', function (e) { |
| 54 | console.error(e); |
| 55 | }); |
| 56 | } |