Merge pull request #9 from zach-klippenstein/start-server-errs

Added command output to StartServer error.
This commit is contained in:
Zach Klippenstein 2016-01-08 14:35:08 -08:00
commit 11dc26d9ba

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)
}