Added command output to StartServer error.

This commit is contained in:
Zach Klippenstein 2016-01-08 10:23:20 -08:00
parent aea57fe58f
commit f8a8785326

View file

@ -2,6 +2,7 @@ package goadb
import (
"os/exec"
"strings"
"github.com/zach-klippenstein/goadb/util"
)
@ -11,6 +12,7 @@ StartServer ensures there is a server running.
*/
func StartServer() error {
cmd := exec.Command("adb", "start-server")
err := cmd.Run()
return util.WrapErrorf(err, util.ServerNotAvailable, "error starting server: %s", err)
output, err := cmd.CombinedOutput()
outputStr := strings.TrimSpace(string(output))
return util.WrapErrorf(err, util.ServerNotAvailable, "error starting server: %s\noutput:\n%s", err, outputStr)
}