From: Sergey Matveev Date: Sun, 15 Mar 2015 07:53:51 +0000 (+0300) Subject: Exit quietly if no script is found, as many of them are optional X-Git-Tag: 2.2^2~5 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1722999d6c106349d1254e041d618c9df76ede24;p=govpn.git Exit quietly if no script is found, as many of them are optional Signed-off-by: Sergey Matveev --- diff --git a/common.go b/common.go index b38f52b..b42673c 100644 --- a/common.go +++ b/common.go @@ -23,6 +23,7 @@ import ( "encoding/hex" "io/ioutil" "log" + "os" "os/exec" ) @@ -41,6 +42,9 @@ func ScriptCall(path, ifaceName string) ([]byte, error) { if path == "" { return nil, nil } + if _, err := os.Stat(path); err != nil && os.IsNotExist(err) { + return nil, err + } cmd := exec.Command(path, ifaceName) var out bytes.Buffer cmd.Stdout = &out