summaryrefslogtreecommitdiff
path: root/vendor/src/github.com/godbus/dbus/conn_other.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/src/github.com/godbus/dbus/conn_other.go')
-rw-r--r--vendor/src/github.com/godbus/dbus/conn_other.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/vendor/src/github.com/godbus/dbus/conn_other.go b/vendor/src/github.com/godbus/dbus/conn_other.go
new file mode 100644
index 0000000000..f74b8758d4
--- /dev/null
+++ b/vendor/src/github.com/godbus/dbus/conn_other.go
@@ -0,0 +1,27 @@
+// +build !darwin
+
+package dbus
+
+import (
+ "bytes"
+ "errors"
+ "os/exec"
+)
+
+func sessionBusPlatform() (*Conn, error) {
+ cmd := exec.Command("dbus-launch")
+ b, err := cmd.CombinedOutput()
+
+ if err != nil {
+ return nil, err
+ }
+
+ i := bytes.IndexByte(b, '=')
+ j := bytes.IndexByte(b, '\n')
+
+ if i == -1 || j == -1 {
+ return nil, errors.New("dbus: couldn't determine address of session bus")
+ }
+
+ return Dial(string(b[i+1 : j]))
+}