-
Notifications
You must be signed in to change notification settings - Fork 43
Description
The autoExitHook
method of the IPCTransport
class calls an undocumented method of the node.js process
class, namely _getActiveHandles
.
This method does not exist in the process class of Deno 2, and so causes a crash when running under that environment.
I note that this isn't the only place in the @pm2/io code where this undocumented method is used; However, in the other instance, there is a safety check to ensure that this undocumented method exists before calling it.
See the init
method of EventLoopHandlesRequestsMetric
, where the following safety check is made before calling the undocumented method:
if (typeof (process as any)._getActiveHandles === 'function' && ...
As a quick-fix (without admittedly understanding the significance of autoExitHook), I would suggest adding a similar safety check to the autoExitHook
method so as to not cause crashes in Deno 2. In the worst case, this change would result in a less severe bug when running under Deno 2.