Skip to content

Commit

Permalink
Avoid exiting on error in an included files (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Oct 23, 2015
1 parent f8349f5 commit 428df35
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ Get a released version on: https://github.com/moul/advanced-ssh-config/releases

### master (unreleased)

* No entry
* Avoid exiting when an included file contains errors ([#95](https://github.com/moul/advanced-ssh-config/issues/95))

[Full commits list](https://github.com/moul/advanced-ssh-config/compare/v2.1.0...master)

Expand Down
8 changes: 3 additions & 5 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,7 @@ func (c *Config) LoadFile(filename string) error {

// Handling includes
for _, include := range c.Includes {
err = c.LoadFiles(include)
if err != nil {
if err = c.LoadFiles(include); err != nil {
return err
}
}
Expand All @@ -282,9 +281,8 @@ func (c *Config) LoadFiles(pattern string) error {

// Load files iteratively
for _, filepath := range filepaths {
err := c.LoadFile(filepath)
if err != nil {
return err
if err := c.LoadFile(filepath); err != nil {
Logger.Warnf("Cannot include %q: %v", filepath, err)
}
}

Expand Down

0 comments on commit 428df35

Please sign in to comment.