Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

console: Don't return error for non-existing files #83

Merged
merged 2 commits into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions console.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ func NewFileSerialPortAttachment(path string, shouldAppend bool) (*FileSerialPor
if macosMajorVersionLessThan(11) {
return nil, ErrUnsupportedOSVersion
}
if _, err := os.Stat(path); err != nil {
return nil, err
}

cpath := charWithGoString(path)
defer cpath.Free()
Expand Down
9 changes: 2 additions & 7 deletions issues_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,8 @@ func TestIssue43(t *testing.T) {
})

cases := map[string]func() error{
// This is also fixed issue #71
"NewFileSerialPortAttachment": func() error {
_, err := NewFileSerialPortAttachment(doesNotExists, false)
return err
},
"NewSharedDirectory": func() error {
_, err := NewFileSerialPortAttachment(doesNotExists, false)
_, err := NewSharedDirectory(doesNotExists, false)
return err
},
"NewDiskImageStorageDeviceAttachment": func() error {
Expand All @@ -113,7 +108,7 @@ func TestIssue43(t *testing.T) {
if err == nil {
t.Fatal("expected returns error")
}
if !errors.Is(err, os.ErrNotExist) {
if !errors.Is(err, ErrUnsupportedOSVersion) && !errors.Is(err, os.ErrNotExist) {
t.Errorf("want underlying error %q but got %q", os.ErrNotExist, err)
}
})
Expand Down