os: implement and smoketest os.Chdir

This commit is contained in:
Dan Kegel
2021-12-04 11:17:28 -08:00
committed by Ron Evans
parent d62c9696fb
commit e668c8c1a7
3 changed files with 66 additions and 0 deletions
+9
View File
@@ -27,6 +27,15 @@ const DevNull = "/dev/null"
// filesystem support.
const isOS = true
// Chdir changes the current working directory to the named directory.
// If there is an error, it will be of type *PathError.
func Chdir(dir string) error {
if e := syscall.Chdir(dir); e != nil {
return &PathError{Op: "chdir", Path: dir, Err: e}
}
return nil
}
// unixFilesystem is an empty handle for a Unix/Linux filesystem. All operations
// are relative to the current working directory.
type unixFilesystem struct {