diff options
Diffstat (limited to 'vendor/github.com/godbus/dbus/conn_other.go')
-rw-r--r-- | vendor/github.com/godbus/dbus/conn_other.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/vendor/github.com/godbus/dbus/conn_other.go b/vendor/github.com/godbus/dbus/conn_other.go index 289044a44..616dcf664 100644 --- a/vendor/github.com/godbus/dbus/conn_other.go +++ b/vendor/github.com/godbus/dbus/conn_other.go @@ -14,8 +14,10 @@ import ( "strings" ) +var execCommand = exec.Command + func getSessionBusPlatformAddress() (string, error) { - cmd := exec.Command("dbus-launch") + cmd := execCommand("dbus-launch") b, err := cmd.CombinedOutput() if err != nil { @@ -25,7 +27,7 @@ func getSessionBusPlatformAddress() (string, error) { i := bytes.IndexByte(b, '=') j := bytes.IndexByte(b, '\n') - if i == -1 || j == -1 { + if i == -1 || j == -1 || i > j { return "", errors.New("dbus: couldn't determine address of session bus") } |