bombshell-dev / clack

Effortlessly build beautiful command-line apps
https://clack.cc
5.63k stars 96 forks source link

MaxListenersExceededWarning #40

Closed SeverinAlexB closed 1 year ago

SeverinAlexB commented 1 year ago

Environment

Describe the bug

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 end listeners added to [ReadStream]. Use emitter.setMaxListeners() to increase limit

To Reproduce After using the await select a lot, the warning message above shows up.

Expected behavior Should not show up.

Additional Information

CleanShot 2023-02-15 at 10 12 03@2x

Let me know if you got questions. It's probably just even emitter listener cleanup.

wrodriguez83 commented 1 year ago

It happens to me too, but after 10 differents prompts (confirms, select, inputs, etc)

wrodriguez83 commented 1 year ago

I found a temporal solution, I added this code in my index.ts:

import { EventEmitter } from "node:stream"; EventEmitter.setMaxListeners(0);

I hope that it helps you, while the bug is fixed

ulken commented 1 year ago

I looked into this and think I found the culprit (at least the warning no longer shows up after generating 10+ prompts).

kyllan16693 commented 1 year ago

I still have this issue. Is the best work around setting max emitters to 0?