summaryrefslogtreecommitdiff
path: root/cmds/cd.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmds/cd.go')
-rw-r--r--cmds/cd.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/cmds/cd.go b/cmds/cd.go
index 3a5e9d0..8fa3c5e 100644
--- a/cmds/cd.go
+++ b/cmds/cd.go
@@ -4,12 +4,15 @@ import "os"
// chDir: changes the current working directory
// if no directory is specifed sets it to home
-func ChDir(args []string) error {
+func ChDir(args []string) (int, error) {
var dir string
if len(args) == 1 {
dir, _ = os.UserHomeDir()
} else {
dir = args[1]
}
- return os.Chdir(dir)
+ if err := os.Chdir(dir); err != nil {
+ return 1, err
+ }
+ return 0, nil
}