Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ebebbington committed Apr 28, 2024
1 parent 47c9073 commit b8aa82f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
16 changes: 11 additions & 5 deletions src/client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Protocol as ProtocolClass } from "./protocol.ts";
import { Protocol as ProtocolTypes } from "../deps.ts";
import { Protocol as ProtocolTypes, deferred } from "../deps.ts";
import { Page } from "./page.ts";
import type { Browsers } from "./types.ts";
import { existsSync } from "./utility.ts";
Expand Down Expand Up @@ -182,10 +182,13 @@ export class Client {
this.#browser_process.stderr!.cancel();
this.#browser_process.stdout!.cancel();
this.#browser_process.kill();
await this.#browser_process.status
await this.#browser_process.status;
} else {
//When Working with Remote Browsers, where we don't control the Browser Process explicitly
// When Working with Remote Browsers, where we don't control the Browser Process explicitly
const p = deferred()
this.#protocol.socket.onclose = () => p.resolve()
await this.#protocol.send("Browser.close");
await p
}

// Zombie processes is a thing with Windows, the firefox process on windows
Expand Down Expand Up @@ -280,8 +283,11 @@ export class Client {
// We could just loop on the fetch of the /json/list endpoint, but we could tank the computers resources if the endpoint
// isn't up for another 10s, meaning however many fetch requests in 10s
// Sometimes it takes a while for the "Devtools listening on ws://..." line to show on windows + firefox too
for await (const line of browserProcess.stderr.pipeThrough(new TextDecoderStream()).pipeThrough(new TextLineStream())) { // Loop also needed before json endpoint is up
console.log(line)
for await (
const line of browserProcess.stderr.pipeThrough(new TextDecoderStream())
.pipeThrough(new TextLineStream())
) { // Loop also needed before json endpoint is up
console.log(line);
const match = line.match(/^DevTools listening on (ws:\/\/.*)$/);
if (!match) {
continue;
Expand Down
3 changes: 1 addition & 2 deletions tests/console/bumper_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ Deno.test("Updates chrome version in dockerfile", async () => {
"./tests/integration/docker_test/drivers.dockerfile",
newContent,
);
const p = new Deno.Command('deno', {
const p = new Deno.Command("deno", {
args: ["run", "-A", "console/bumper_ci_service.ts"],
});
const child = p.spawn();
await child.status;
child.kill();
newContent = Deno.readTextFileSync(
"./tests/integration/docker_test/drivers.dockerfile",
);
Expand Down

0 comments on commit b8aa82f

Please sign in to comment.