Check the chosen command for existence
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
@@ -147,6 +148,12 @@ func (c *Config) UpdateFromJSON(j []byte) error {
|
||||
}
|
||||
}
|
||||
|
||||
// check the command exists
|
||||
_, err := exec.LookPath(newConfig.DownloadProfiles[i].Command)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Could not find %s on the path", newConfig.DownloadProfiles[i].Command)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
*c = newConfig
|
||||
|
||||
Reference in New Issue
Block a user