mirror of https://github.com/mvdan/fdroidcl.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
428 B
29 lines
428 B
|
10 years ago
|
// Copyright (c) 2015, Daniel Martí <mvdan@mvdan.cc>
|
||
|
|
// See LICENSE for licensing information
|
||
|
|
|
||
|
|
package adb
|
||
|
|
|
||
|
|
import (
|
||
|
|
"fmt"
|
||
|
|
"net"
|
||
|
|
"os/exec"
|
||
|
|
)
|
||
|
|
|
||
|
|
const (
|
||
|
|
host = "127.0.0.1"
|
||
|
|
port = 5037
|
||
|
|
)
|
||
|
|
|
||
|
|
func IsServerRunning() bool {
|
||
|
|
conn, err := net.Dial("tcp", fmt.Sprintf("%s:%d", host, port))
|
||
|
|
if err != nil {
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
conn.Close()
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
func StartServer() error {
|
||
|
|
return exec.Command("adb", "start-server").Run()
|
||
|
|
}
|