Add a test for creation of anonymous tempfiles

This commit is contained in:
Kovid Goyal
2023-01-26 11:51:02 +05:30
parent 4185e30d73
commit eb50fac8de
2 changed files with 31 additions and 1 deletions

View File

@@ -24,7 +24,11 @@ func CreateAnonymousTemp(dir string) (*os.File, error) {
return os.NewFile(uintptr(fd), path), nil
}
if err == unix.ENOENT {
return nil, err
return nil, &os.PathError{
Op: "open",
Path: dir,
Err: err,
}
}
f, err := os.CreateTemp(dir, "")
if err != nil {