Skip to content

Commit

Permalink
fix: catch module.parent.filename === undefined (#1053)
Browse files Browse the repository at this point in the history
It happened with electron.js. Maybe some wrapper module has a native nature
  • Loading branch information
mikeifomin authored and remy committed Sep 4, 2017
1 parent 1613394 commit 4c81e9a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ var utils = module.exports = {
isLinux: process.platform === 'linux',
isRequired: (function () {
var p = module.parent;
while (p) {
while (p) {
// in electron.js engine it happens
if (p.filename === undefined) {
return true;
}
if (p.filename.indexOf('bin' + path.sep + 'nodemon.js') !== -1) {
return false;
}
Expand Down Expand Up @@ -87,4 +91,4 @@ Object.defineProperty(utils, 'colours', {
get: function () {
return this.log.useColours;
},
});
});

0 comments on commit 4c81e9a

Please sign in to comment.