Check the chosen command for existence
This commit is contained in:
parent
0bfa38fff5
commit
14a35cdd9e
@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- Check the chosen command exists when configuring a profile
|
||||
|
||||
## [v0.5.3] - 2021-11-21
|
||||
|
||||
- Add config option to limit number of simultaneous downloads
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user