Skip to content
This repository was archived by the owner on Apr 28, 2020. It is now read-only.

FIXES #201 Sail browser extension docker not found error on MacOS #264

Merged
merged 3 commits into from
Mar 17, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions globalflags.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package main

import (
"flag"
"fmt"
"net/url"
"os"
"os/exec"
"os/user"
"path/filepath"
"runtime"
"strings"

"github.com/fatih/color"
Expand Down Expand Up @@ -37,6 +39,15 @@ func (gf *globalFlags) config() config {

// ensureDockerDaemon verifies that Docker is running.
func (gf *globalFlags) ensureDockerDaemon() {
if runtime.GOOS == "darwin" {
path := os.Getenv("PATH")
localBin := "/usr/local/bin"
if !strings.Contains(path, localBin) {
sep := fmt.Sprintf("%c", os.PathListSeparator)
// Fix for MacOS to include /usr/local/bin where docker is commonly installed which is not included in $PATH when sail is launched by browser that was opened in Finder
os.Setenv("PATH", strings.Join([]string{path, localBin}, sep))
}
}
out, err := exec.Command("docker", "info").CombinedOutput()
if err != nil {
flog.Fatal("failed to run `docker info`: %v\n%s", err, out)
Expand Down