chalk icon indicating copy to clipboard operation
chalk copied to clipboard

refactor(util): resolve addQuitProc deprecation warning

Open ee7 opened this issue 1 year ago • 0 comments

Like https://github.com/crashappsec/chalk/pull/279, a small PR to get rid of deprecation warnings and reduce noise locally (e.g. when running nimble build -d:debug).


Resolve the deprecation warning:

src/util.nim(59, 3) Warning: use exitprocs.addExitProc; addQuitProc is deprecated [Deprecated]

addQuitProc was deprecated in June 2020, and in Nim 1.4.0.

The rationale was that addQuitProc:

  • "Used atexit() blindly without making its own callback stack". timotheecour wrote:

    I'm deprecating addQuitProc because it shouldn't be in system in the first place, and because you can't guarantee a sane ordering (last in first out) if you mix regular vs closure procs; however existing code won't break"

  • Had a C limitation of 30 atExit calls.
  • Didn't work for -d:js (node and browser).

ee7 avatar Apr 30 '24 10:04 ee7