Top level await for Node.js process #59
Labels
enhancement
New feature or request
javascript
Relates to JavaScript or Node.js code
pipes
Relates to interprocess streaming
python
Relates to Python code
Milestone
Node.js supports await/async behaviour even in the top-level scope, either through the
--harmony-top-level-await
flag prior to Node.js 14.8, or for ES modules since Node.js 14.9. Qualifying as an ES module for the purpose of this feature is in principle achievable using.mjs
file extensions, declaring"type": "module"
in the relevant package.json file, or by passing an--input-type=module
flag to the node process when eval-ing script strings. This lattermost option sounds most relevant to Bifrost, but evidence suggests that none of these flags are meaningful when passed to to the Node.js process initialization (via subprocess.Popen in python, atpy_nodejs.py
), which is setting up a process which will be called via streaming pipes and populated via shared memory, rather than passing scripts to be directly eval-ed by a new Node.js process.Top-level await is a desirable feature to support for Bifrost broadly, if possible. When investigating solutions, please consider both the above caveats relating to the relevant flags, and also consider how solutions might impact or be impacted by the following behaviour of Bifrost's current script evaluation code, taken from
main.js
:Whatever solution is implemented should be able to support the async initalization of
dcp-client
using top-level await.The text was updated successfully, but these errors were encountered: