From 029cc6bee4812bf83c5d5fa58c49a82ff000d02c Mon Sep 17 00:00:00 2001 From: Tobias Salzmann Date: Tue, 30 May 2017 02:51:45 +0200 Subject: [PATCH] Respect specified adb server port when issuing adb start-server (#28) When a custom host/port is specified for connecting to the adb server, they are used to establish the connection. However, if the server is not running, they are not passed to the `adb start-server` command, and so the connection will fail because the server isn't listening on the expected port. This change passes the address to the command, according to the following line from the adb usage info: ``` -L SOCKET listen on given socket for adb server [default=tcp:localhost:5037] ``` --- server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.go b/server.go index 6b6d135..68e5896 100644 --- a/server.go +++ b/server.go @@ -109,7 +109,7 @@ func (s *realServer) Dial() (*wire.Conn, error) { // StartServer ensures there is a server running. func (s *realServer) Start() error { - output, err := s.config.fs.CmdCombinedOutput(s.config.PathToAdb, "start-server") + output, err := s.config.fs.CmdCombinedOutput(s.config.PathToAdb, "-L", fmt.Sprintf("tcp:%s", s.address), "start-server") outputStr := strings.TrimSpace(string(output)) return errors.WrapErrorf(err, errors.ServerNotAvailable, "error starting server: %s\noutput:\n%s", err, outputStr) }