os: stub out support for some more features

This is necessary for the following:

  - to make sure os/exec can be imported
  - to make sure internal/testenv can be imported

The internal/testenv package (which imports os/exec) is used by a lot of
tests. By adding support for it, more tests can be run.

This commit adds a bunch of new packages that now pass all tests.
This commit is contained in:
Ayke van Laethem
2020-09-25 19:59:48 +02:00
committed by Ron Evans
parent 6cbaed75c8
commit 718746dd21
12 changed files with 186 additions and 12 deletions
+31
View File
@@ -52,6 +52,16 @@ func Remove(path string) error {
return nil
}
// Symlink is a stub, it is not implemented.
func Symlink(oldname, newname string) error {
return ErrNotImplemented
}
// RemoveAll is a stub, it is not implemented.
func RemoveAll(path string) error {
return ErrNotImplemented
}
// File represents an open file descriptor.
type File struct {
handle FileHandle
@@ -187,6 +197,27 @@ func (e *PathError) Error() string {
return e.Op + " " + e.Path + ": " + e.Err.Error()
}
func (e *PathError) Unwrap() error {
return e.Err
}
// LinkError records an error during a link or symlink or rename system call and
// the paths that caused it.
type LinkError struct {
Op string
Old string
New string
Err error
}
func (e *LinkError) Error() string {
return e.Op + " " + e.Old + " " + e.New + ": " + e.Err.Error()
}
func (e *LinkError) Unwrap() error {
return e.Err
}
const (
O_RDONLY int = syscall.O_RDONLY
O_WRONLY int = syscall.O_WRONLY