Skip to content

util: attach return value to promisified functions

Rodrigo Muino Tomonari requested to merge github/fork/Hakerh400/prom into master

Some functions that perform asynchronous tasks and take a callback also return a synchronous result which can be used in the same tick. Previously util.promisify was discarding the return value.

While #28325 solved the problem for some specific functions, the general problem for user-defined functions remained. It seems that not so rare practice is to return a useful value along with scheduling asynchronous actions in a function which takes a callback.

Documentation is not added yet. I would like to hear some feedback first regarding whether this change is a good change (or maybe some better suggestions for the symbol name?).

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Merge request reports

Loading