Skip to content

Commit 2d09861

Browse files
committed
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 00f44fe commit 2d09861

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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)