-
Notifications
You must be signed in to change notification settings - Fork 387
Description
While working on #11135 and #11187, I found a problem of chrome processes not being closed after Quarto ends. This specific cleaning problem should be fixed with #11195. However, the initial problem still remains.
Browser process started with Deno.run for CRI client should be closed upon client closing
quarto-cli/src/core/cri/cri.ts
Lines 121 to 125 in c96fe72
| const result = { | |
| close: async () => { | |
| await client.close(); | |
| browser.close(); | |
| }, |
However, from interactive debugging, it happens browser.close() is never called above as await client.close() somehow does not return in a way the next command is ran.
This whole logic is used in withCriClient() like in
quarto-cli/src/core/handlers/base.ts
Lines 180 to 190 in c96fe72
| const { elements, images } = await withCriClient(async (client) => { | |
| await client.open(url); | |
| const elements = await client.contents(selector); | |
| const screenshots = await client.screenshots( | |
| selector, | |
| deviceScaleFactor, | |
| ); | |
| return { | |
| elements, | |
| images: screenshots.map((x) => x.data), | |
| }; |
And return() is correctly stepped in, but process started for client is not closed.
So this issue should be dealt with - however, this could be also done in a broader improvement work that could be needed anyway. Chrome Headless new mode is now the default, and old mode will be removed from chromium binary inside its own binary. So new mode should be used and some adaptation are done anyway.