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

Fix race condition #23

Merged
merged 1 commit into from Jul 31, 2015
Merged

Fix race condition #23

merged 1 commit into from Jul 31, 2015

Conversation

tedbreen
Copy link
Contributor

Two things:

  1. Reverting back to browserify's original bundle method. This method is only intended to take a singular argument (a callback in this case).
  2. stream.on('end', function () {}) creates a race condition. Using a callback in the bundle method instead to resolve this.

fs.writeFile(cssOutFilename, css, function(err) {
if (err) console.error(err);
fs.writeFile(cssOutFilename, css, function () {
cb.apply(null, args);
Copy link
Member

Choose a reason for hiding this comment

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

Good one, thanks. Could you please update so that cb only gets called if it exists?

@tedbreen tedbreen force-pushed the patch-1 branch 2 times, most recently from 10a5952 to 074fc05 Compare July 31, 2015 00:17
Two things:

1) Reverting back to browserify's original bundle method. This method is only intended to take a singular callback argument.
2) stream.on('end', function () {}) creates a race condition. Using a callback in the bundle method instead to resolve this.
@tedbreen
Copy link
Contributor Author

@joshwnj updated to check if cb exists

@joshwnj
Copy link
Member

joshwnj commented Jul 31, 2015

Thanks!

joshwnj added a commit that referenced this pull request Jul 31, 2015
@joshwnj joshwnj merged commit ff9c24c into css-modules:master Jul 31, 2015
@joshwnj
Copy link
Member

joshwnj commented Jul 31, 2015

@tedbreen are you using css-modulesify in production? At some point we'll want to get this to v1.0 so will be good to know who is using it and how :)

@joshwnj
Copy link
Member

joshwnj commented Jul 31, 2015

leaving a note here for future reference: I had to upgrade browserify to v11 with this version as v10 was having issues.

@tedbreen
Copy link
Contributor Author

@joshwnj yes, Getable is using it in production!

@joshwnj
Copy link
Member

joshwnj commented Jul 31, 2015

cool!

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.

None yet

2 participants