Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better waiting for chrome instance to launch #8

Open
andrewvy opened this issue Oct 23, 2017 · 3 comments
Open

Better waiting for chrome instance to launch #8

andrewvy opened this issue Oct 23, 2017 · 3 comments
Assignees
Milestone

Comments

@andrewvy
Copy link
Owner

Instead of polling blindly right when we launch the chrome process with erl-exec, a hacky-way is to wait for stdout before polling.

@andrewvy andrewvy added this to the v1.0.0 milestone Oct 23, 2017
@andrewvy andrewvy self-assigned this Oct 23, 2017
@andrewvy
Copy link
Owner Author

andrewvy commented Oct 26, 2017

Looks like there is already discussion of "pre-opening a socket" before exec a chrome instance, and then passing it in as an option at startup: https://bugs.chromium.org/p/chromium/issues/detail?id=624837

Though, I'm not sure if erlexec is able to handle this.

Additional docs: https://unix.stackexchange.com/questions/248408/file-descriptors-across-exec


Actually, there's a hackier workaround if ^ doesn't work. (Comment #4)

@andrewvy
Copy link
Owner Author

andrewvy commented Oct 26, 2017

Some options:

  • Wait for stdout message that has a format of DevTools listening on 127.0.0.1:9222, then poll. (This is what puppeteer does, not sure why it's a separate implementation from chrome-launcher)

  • Wait for DevToolsActivePort file to get created in --user-data-dir, then poll.

  • Figure out how to pass file descriptors // pre-open socket and pass it into chrome

@bcardarella
Copy link
Contributor

Wait for stdout message that has a format of

I don't think this is a viable option. Headless outputs everything to stderr. I logged a bug about this last week and it was marked as wontfix

https://bugs.chromium.org/p/chromium/issues/detail?id=773572&can=1&q=stderr&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants