cdp: handle stdio sending when closed

This commit is contained in:
CanadaHonk 2023-01-28 12:11:04 +00:00
parent 1a74923cff
commit efff1770e5

View File

@ -121,8 +121,12 @@ export default async ({ pipe: { pipeWrite, pipeRead } = {}, port }) => {
pipeRead.on('close', () => log('pipe read closed'));
_send = data => {
pipeWrite.write(data);
pipeWrite.write('\0');
if (closed) return new Error('CDP connection closed');
try {
pipeWrite.write(data);
pipeWrite.write('\0');
} catch { } // error writing, likely closed/closing (cannot check)
};
_close = () => {};