denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
97.79k stars 5.38k forks source link

Feature: Support SIGHUP and SIGBREAK (port libuv support?) #16298

Open tamusjroyce opened 2 years ago

tamusjroyce commented 2 years ago

As deno ramps up to become compatible with node, is there an effort for porting libuv wrapper for console signals from libuv to a rust library compatible with Tokio? Specifically, SIGHUP and SIGBREAK - specifically src/win/signalc?

https://github.com/microsoft/playwright/issues/3146

Thanks for any input on effort towards this. libuv doesn't have to be the source. And this may be a small step towards getting libraries like puppeteer and playwright to work. And other libraries, like https://github.com/atroche/rust-headless-chrome, may supersede the need for these two.

Or possible compatibly on how libuv and tokio setup websockets.

There are two ways for playwright and puppeteer to communicate with chrome/edge. websockets or signals & streams.

Thank you! -TamusJRoyce

tamusjroyce commented 2 years ago

https://github.com/libuv/libuv

jeroendee commented 2 years ago

@bartlomieju as per your request in your talk: State of Deno 2022 before I create a new issue requesting for Playwright support in Deno... ;-)

lucacasonato commented 2 years ago

Do you have a specific example of what code does not work right now, that you think should? Deno already supports sending SIGHUP and SIGBREAK signals to child processes (through child.kill("SIGHUP"))

d4h0 commented 2 years ago

@lucacasonato: Here is a snippet that I've tried previously (not tested with the current Deno release):

import { chromium } from 'npm:playwright';

async function main() {
  // const browser = await chromium.connectOverCDP("ws://127.0.0.1:37305/devtools/browser/d8da9c70-6b9c-45a4-8582-c26095adb110");
  const browser = await chromium.launch({
    headless: false,
  });
  const page = await browser.newPage();
  await page.goto('http://example.com');
  await browser.close();
};

if (import.meta.main) {
  main()
}

Please see my comment in the above-mentioned issue in the Playwright repo, which contains more information (including the error message).

d4h0 commented 1 year ago

I've opened a new issue specifically about Playwright: https://github.com/denoland/deno/issues/16899

tamusjroyce commented 1 year ago

Do you have a specific example of what code does not work right now, that you think should? Deno already supports sending SIGHUP and SIGBREAK signals to child processes (through child.kill("SIGHUP"))

This isn't sending a SIGNUP to a child process. But rather. Listening to SIGHUP.

tamusjroyce commented 1 year ago

https://github.com/denoland/deno/blob/main/runtime/ops/signal.rs :447 https://github.com/libuv/libuv/blob/v1.x/src/win/signal.c

tamusjroyce commented 1 year ago

Any word on fixing the TODO on line 59 of https://github.com/marvinhagemeister/deno/blob/794ce1c691117242c41e796cd9f7600fbfb939dc/runtime/ops/signal.rs?

// TODO: CtrlClose could be mapped to SIGHUP but that needs a // tokio::windows::signal::CtrlClose type, or something from a different crate

SIGHUP and SIGBREAK

Oh. I think SIGHUP is fine. It is just SIGBREAK on windows

tamusjroyce commented 2 months ago

Heard that Deno 1.46 has this issue resolved. Will give it a try tonight.

If you find this is open past 9/1/2024, feel free to close this issue