Return a friendlier error for empty executables

This commit is contained in:
Christian Muehlhaeuser 2018-03-13 03:03:35 +01:00
parent e1d5cc843f
commit b3058e9894
1 changed files with 3 additions and 0 deletions

View File

@ -134,6 +134,9 @@ func validate() error {
}
// Exec check
if len(strings.TrimSpace(createOpts.Exec)) == 0 {
return fmt.Errorf("Need an executable to create a service for")
}
stat, err := os.Stat(createOpts.Exec)
if os.IsNotExist(err) {
return fmt.Errorf("Could not find executable: %s is not a file", createOpts.Exec)