Skip to content

Commit

Permalink
Merge pull request #932 from jvortmann/check_presence_socat_anywhere_…
Browse files Browse the repository at this point in the history
…in_path_using_command_v

Use 'comand -v' to check presence of socat anywhere in path #869.
  • Loading branch information
bradrydzewski committed Mar 22, 2015
2 parents 400461e + 0e3b499 commit aa3eeda
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion shared/build/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ set +e
// this command string will check if the socat utility
// exists, and if it does, will proxy connections to
// the external IP address.
const command = "[ -x /usr/bin/socat ] && socat TCP-LISTEN:%s,fork TCP:%s:%s &\n"
const command = "command -v socat >/dev/null && socat TCP-LISTEN:%s,fork TCP:%s:%s &\n"

// alternative command that acts as a "polyfill" for socat
// in the event that it isn't installed on the server
Expand Down
2 changes: 1 addition & 1 deletion shared/build/proxy/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func TestProxy(t *testing.T) {
p.Set("8080", "172.1.4.5")
b := p.Bytes()

expected := header + "[ -x /usr/bin/socat ] && socat TCP-LISTEN:8080,fork TCP:172.1.4.5:8080 &\n"
expected := header + "command -v socat >/dev/null && socat TCP-LISTEN:8080,fork TCP:172.1.4.5:8080 &\n"
if string(b) != expected {
t.Errorf("Invalid proxy got:\n%s\nwant:\n%s", string(b), expected)
}
Expand Down

0 comments on commit aa3eeda

Please sign in to comment.