Skip to content

Commit

Permalink
Update tools/run.js to check if files are run directly from Node.js (…
Browse files Browse the repository at this point in the history
…#747)

* Update tools/run.js to check if files are run directly from Node.js

* Revert eslint rule comment
  • Loading branch information
goal-dev committed Jul 15, 2016
1 parent fdfc264 commit 1b819aa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function run(fn, options) {
});
}

if (process.mainModule.children.length === 0 && process.argv.length > 2) {
if (require.main === module && process.argv.length > 2) {
delete require.cache[__filename]; // eslint-disable-line no-underscore-dangle
const module = require(`./${process.argv[2]}.js`).default;
run(module).catch(err => console.error(err.stack));
Expand Down

0 comments on commit 1b819aa

Please sign in to comment.