Skip to content

Commit

Permalink
Merge pull request #264 from NeowayLabs/dontAbortOnInitLoadFailure
Browse files Browse the repository at this point in the history
print init loading fatal error instead of exiting
  • Loading branch information
i4ki authored Apr 3, 2018
2 parents 28aecce + c483b3d commit 578f961
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cmd/nash/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ func importInitFile(shell *nash.Shell, initFile string) (bool, error) {
return false, nil
}

func setupCli(shell *nash.Shell) error {
shell.SetInteractive(true)

func loadInit(shell *nash.Shell) error {

if noInit {
return nil
}
Expand All @@ -91,8 +90,11 @@ func setupCli(shell *nash.Shell) error {
}

func cli(shell *nash.Shell) error {
if err := setupCli(shell); err != nil {
return err

shell.SetInteractive(true)

if err := loadInit(shell); err != nil {
fmt.Fprintf(os.Stderr, "error loading init file:\n%s\n", err)
}

historyFile := shell.DotDir() + "/history"
Expand Down

0 comments on commit 578f961

Please sign in to comment.