Skip to content

Commit 05374a7

Browse files
addaleaxnfischer
authored andcommitted
Silence potentially upcoming circular dependency warning (#973)
Node.js is currently considering printing a warning when a non-existent property of `module.exports` is accessed while in a circular `require()` dependency, in order to make it easier to catch issues with circular dependencies. In order to avoid printing these warnings for shelljs, checking for the property’s existence rather than its truthiness suffices. Refs: nodejs/node#29935
1 parent 9aef002 commit 05374a7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ function _register(name, implementation, wrapOptions) {
478478
// If an option isn't specified, use the default
479479
wrapOptions = Object.assign({}, DEFAULT_WRAP_OPTIONS, wrapOptions);
480480

481-
if (shell[name]) {
481+
if (shell.hasOwnProperty(name)) {
482482
throw new Error('Command `' + name + '` already exists');
483483
}
484484

0 commit comments

Comments
 (0)