wrapper: Write stdout/stderr data to stream when received (#410)

* wrapper: write stdout/stderr data to stream when received

* add a delay test

* temp comment

* uncomment actions

* add changelog
This commit is contained in:
Austin Valle 2024-05-07 09:51:25 -04:00 committed by GitHub
parent 5f32e8acaf
commit 99441ecd44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 85 additions and 18 deletions

View file

@ -20,13 +20,18 @@
* console.log(listener.contents);
*/
class OutputListener {
constructor () {
constructor (streamWriter) {
this._buff = [];
this._streamWriter = streamWriter;
}
get listener () {
const listen = function listen (data) {
this._buff.push(data);
if (this._streamWriter) {
this._streamWriter.write(data);
}
};
return listen.bind(this);
}