Skip to content
This repository was archived by the owner on Apr 30, 2021. It is now read-only.

Conversation

@kjk
Copy link
Contributor

@kjk kjk commented Aug 2, 2019

If .fuzzit.cache gets corrupted so that it can't be json-decoded, fuzzit auth will be stuck forever.

Try to prevent that by deleting the file if it fails decoding.

if err != nil {
return err
}
defer file.Close()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this line is removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's moved after json.NewDecoder() because on e.g. windows one cannot remove opened file so we have to call file.Close() before os.Remove() and defer file.Close() means it would be called after.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. nice!

@yevgenypats yevgenypats merged commit 2038de3 into fuzzitdev:master Aug 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants