mirror of
https://github.com/hashicorp/setup-terraform.git
synced 2025-12-25 04:37:06 +00:00
wrapper: write stdout/stderr data to stream when received
This commit is contained in:
parent
1f0219f06b
commit
003aea7b7b
4 changed files with 38 additions and 17 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue