Created
October 18, 2021 16:41
-
-
Save crutchcorn/a02d47da9d9eeefb00a5bf4fee05863c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This basic premise is being used here: | |
// https://github.com/plopjs/plop/pull/287/files#diff-dc20b7684034e757bccdcb13b82e52fa46e618997d3fcc3e9fddd88bde362607R29-R73 | |
let dataWaitPromises = []; | |
function waitForData() { | |
const promise = new Promise((resolve) => (localDataResolve = resolve)); | |
dataWaitPromises.push({ promise, resolve: localDataResolve }); | |
} | |
exec.stdout.on("data", (result) => { | |
if (dataWaitPromises.length) { | |
dataWaitPromises.forEach((prom) => prom.resolve()); | |
dataWaitPromises = []; | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment