| 12345678910111213141516171819 |
- #!/usr/bin/env node
- const { execSync } = require('child_process')
- const config = require(process.cwd() + '/../../configs/config.js')
- const adbPath = config.adbPath?.path
- const deviceIp = '192.168.0.101'
- const devicePort = '5555'
- /** Run adb connect and return whether connected. */
- function connect() {
- const out = execSync(`"${adbPath}" connect ${deviceIp}:${devicePort}`, { encoding: 'utf-8' }).trim()
- return out.includes('connected') || out.includes('already connected')
- }
- const ok = connect()
- console.log(ok ? `${deviceIp}:${devicePort} Connected` : `${deviceIp}:${devicePort} Connect failed`)
- process.exit(ok ? 0 : 1)
|