From 0e3b499996e548b5f2859476b10d614ffd461457 Mon Sep 17 00:00:00 2001 From: Joao Vortmann Date: Sun, 22 Mar 2015 09:30:01 -0300 Subject: [PATCH] Use command -v to check socat anywhere in path #869. --- shared/build/proxy/proxy.go | 2 +- shared/build/proxy/proxy_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/build/proxy/proxy.go b/shared/build/proxy/proxy.go index 7af6a9b7c..aa7637114 100644 --- a/shared/build/proxy/proxy.go +++ b/shared/build/proxy/proxy.go @@ -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 diff --git a/shared/build/proxy/proxy_test.go b/shared/build/proxy/proxy_test.go index 1e2112515..7dfc450dd 100644 --- a/shared/build/proxy/proxy_test.go +++ b/shared/build/proxy/proxy_test.go @@ -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) }