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
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
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 {