SBoudrias / Inquirer.js

A collection of common interactive command line user interfaces.
MIT License
20.29k stars 1.3k forks source link

Refactor(@inquirer/core): Streamline exit handlers #1543

Closed SBoudrias closed 2 months ago

SBoudrias commented 2 months ago

Alternative answer to #1536.

2 challenges this code brings:

  1. Calling done from a hook cleanup can easily lead to an infinite loop (this code handles it, and there's a unit test covering this case already.)
  2. The cycle function becomes a bit more complex - might need to revisit this piece.
SBoudrias commented 2 months ago

e2e solution in #1542 ended up being more elegant.