Skip to content

Flattened execution chain#21

Closed
ferm10n wants to merge 12 commits intonpm:masterfrom
ferm10n:test2
Closed

Flattened execution chain#21
ferm10n wants to merge 12 commits intonpm:masterfrom
ferm10n:test2

Conversation

@ferm10n
Copy link
Contributor

@ferm10n ferm10n commented May 9, 2017

This change greatly simplifies the operation of write-file-atomic, while also maintaining all functionality. It eliminates the dependency on slide-flow-control and replaces it with promises (I have a PR for that one too! isaacs/slide-flow-control#10)

Everything related to writeFile has been condensed into a single function with a single promise chain, and is very easy to read and follow.

I did this because I felt the nested callbacks pattern was overly complicated. I found it difficult to understand what was going on while investigating the following issue (and wrestling with this problem in my own project, not on github) :

I have a suspicion that these errors are caused on windows when a dependent package calls write-file-atomic multiple times on the same file, attempting to overwrite a file currently being written to. On Unix systems the behavior of fs.rename() simply replaces the file, but on Windows it is apparently more complicated! I have an idea on how to fix it and will make another pull request soon if it works.

@ferm10n ferm10n closed this May 11, 2017
@ferm10n
Copy link
Contributor Author

ferm10n commented May 11, 2017

See #22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant