]> Cypherpunks.ru repositories - govpn.git/commitdiff
Exit quietly if no script is found, as many of them are optional
authorSergey Matveev <stargrave@stargrave.org>
Sun, 15 Mar 2015 07:53:51 +0000 (10:53 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 15 Mar 2015 07:53:51 +0000 (10:53 +0300)
Signed-off-by: Sergey Matveev <stargrave@stargrave.org>
common.go

index b38f52b1d282035c6390daa22e6681dd7f84627a..b42673c98925f32be3b63948f7eaf30eccb186e9 100644 (file)
--- 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