fix: prevent Target closed errors on streams (#7728)

This change prevents Target closed errors when reading streams which were caused by ending the stream before IO.close returns.
This commit is contained in:
Jan Scheffler 2021-10-27 15:49:27 +02:00 committed by GitHub
parent 07febca04b
commit 5b792de7a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -364,9 +364,9 @@ async function getReadableFromProtocolStream(
const response = await client.send('IO.read', { handle, size });
this.push(response.data, response.base64Encoded ? 'base64' : undefined);
if (response.eof) {
this.push(null);
eof = true;
await client.send('IO.close', { handle });
this.push(null);
}
},
});