Skip to content

Commit

Permalink
Ensure that source directory exists in cd command
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Jan 28, 2019
1 parent 7cb7422 commit 4dee096
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/cd.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ func init() {
}

func (c *Config) runCDCommand(fs vfs.FS, args []string) error {
mutator := c.getDefaultMutator(fs)
if err := c.ensureSourceDirectory(fs, mutator); err != nil {
return err
}

if err := os.Chdir(c.SourceDir); err != nil {
return err
}
Expand Down

0 comments on commit 4dee096

Please sign in to comment.