The following code when ran I notice 1-2 seconds event loop block with execSH which use spawn async version. According to NodeJS docs, spawn shouldn’t block event loop unless spawnSync used.
// From https://github.com/tsertkov/exec-sh/blob/master/lib/exec-sh.js
const execSH = require("exec-sh").promise;
const blocked = require('blocked-at')
blocked((time, stack) => {
console.log(`Event Blocked for ${time}ms, operation started here:`, stack)
})
async function c(eName, port) {
await execSH(`avdmanager create avd --name ${eName} --package "system-images;android-34;google_apis;arm64-v8a"`, true);
}
await Promise.all([c("test1", 5412), c("test2", 5413)]);
What cause the blocking?