-
Notifications
You must be signed in to change notification settings - Fork 16
/
feature_gui_darwin.go
38 lines (35 loc) · 1.17 KB
/
feature_gui_darwin.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Builds for OSX
package main
import (
// "github.com/Sirupsen/logrus"
"github.com/fsouza/go-dockerclient"
// "bytes"
"os"
// "net"
// "io"
// log "github.com/Sirupsen/logrus"
"errors"
// "time"
// "strings" // words := strings.Fields(someString)
)
func enableGui() (map[docker.Port][]docker.PortBinding, []string, []string, error) {
guiPortNumber := "6000"
portBindings := map[docker.Port][]docker.PortBinding{}
envVariables := []string{}
binds := make([]string, 0)
displayVariable := os.Getenv("DISPLAY")
if displayVariable == "" {
return portBindings, envVariables, binds, errors.New(
"DISPLAY variable is empty. (Did you install XQuartz properly?)")
} else {
ip, err := bridgeUnixSocketToPort(displayVariable, guiPortNumber)
if err != nil {
return portBindings, envVariables, binds,
errors.New("Network bridging failed: " + err.Error())
} else {
// log.Debug("bridged to ip:", string(ip))
envVariables = append(envVariables, "DISPLAY=" + ip + ":0")
return portBindings, envVariables, binds, nil
}
}
}