Skip to content
This repository has been archived by the owner on Mar 13, 2021. It is now read-only.

Commit

Permalink
Revert "Pass HOME and PATH env vars from riff CLI to docker"
Browse files Browse the repository at this point in the history
The parent's process environment should be inherited by default. (It may not
have been, but that's another matter.)

This reverts commit 3931b32.

Breaks #586
  • Loading branch information
glyn committed May 23, 2018
1 parent 8efed62 commit 909491a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 142 deletions.
13 changes: 0 additions & 13 deletions riff-cli/pkg/docker/docker_suite_test.go

This file was deleted.

23 changes: 3 additions & 20 deletions riff-cli/pkg/docker/docker_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"strings"
"bufio"
"os/exec"
"os"
)

//go:generate mockery -name=Docker -inpkg
Expand Down Expand Up @@ -49,7 +48,9 @@ func DryRunDocker() Docker {
}

func (d *processDocker) Exec(command string, cmdArgs ... string) error {
cmd := createDockerCommand(command, cmdArgs...)
commandAndArgs := append([]string{command}, cmdArgs...)

cmd := exec.Command("docker", commandAndArgs...)
stdout, _ := cmd.StdoutPipe()
stderr, _ := cmd.StderrPipe()
cmd.Start()
Expand All @@ -58,24 +59,6 @@ func (d *processDocker) Exec(command string, cmdArgs ... string) error {
return cmd.Wait()
}

func createDockerCommand(command string, cmdArgs ...string) *exec.Cmd {
commandAndArgs := append([]string{command}, cmdArgs...)
cmd := exec.Command("docker", commandAndArgs...)
cmd.Env = createEnv("HOME", "PATH")
return cmd
}

// create a process environment based on the environment variables with the given keys
func createEnv(keys ... string) []string {
env := []string{}
for _, key := range keys {
if value, set := os.LookupEnv(key); set {
env = append(env, fmt.Sprintf("%s=%s", key, value))
}
}
return env
}

// to print the processed information when stdout gets a new line
func print(scanner *bufio.Scanner, prefix string) {
scanner.Split(bufio.ScanLines)
Expand Down
109 changes: 0 additions & 109 deletions riff-cli/pkg/docker/docker_utils_test.go

This file was deleted.

0 comments on commit 909491a

Please sign in to comment.