Permalink
Browse files

Guard aginst multiple binary includes

npm can install fibers more than once which tends to lead to trouble.

Fixes #102, #177
  • Loading branch information...
laverdet committed Jan 3, 2015
1 parent 68a8a85 commit d9bc3a7b9d486d6f45170501de8626d52dfa5dfa
Showing with 4 additions and 1 deletion.
  1. +4 −1 fibers.js
@@ -1,3 +1,6 @@
if (process.fiberLib) {
return module.exports = process.fiberLib;
}
var fs = require('fs'), path = require('path');

// Seed random numbers [gh-82]
@@ -14,4 +17,4 @@ try {
}

// Pull in fibers implementation
module.exports = require(modPath).Fiber;
process.fiberLib = module.exports = require(modPath).Fiber;

1 comment on commit d9bc3a7

@imShara

This comment has been minimized.

Copy link

imShara commented on d9bc3a7 Jul 1, 2015

WARNING in ./~/fibers/fibers.js
Module parse failed: ......../node_modules/fibers/fibers.js Line 2: Illegal return statement
You may need an appropriate loader to handle this file type.
| if (process.fiberLib) {
|   return module.exports = process.fiberLib;
| }
| var fs = require('fs'), path = require('path');
Please sign in to comment.