You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.
Wrangler starts the browser, then proceeds to watch for changes to the source code.
What did you see instead?
Wrangler starts the browser, then hangs waiting for the browser to exit before it begins watching for changes, defeating the purpose of --watch.
The problem is that running the browser (e.g. running google-chrome <url> on the command line) behaves differently if another browser process is already open or not.
If a process is already running, the new process tells the existing process to open a new tab, and then the new process exits immediately.
If no browser process is already running, the new process becomes the main process, and does not exit until the user closes all browser windows.
When Wrangler opens a preview window by executing the browser, it waits for the process to exit before proceeding. That works fine in the first case but not the second case.
Instead, Wrangler should start the browser process and then not wait for it. Ideally, it would also start the browser in a new process group (using setpgid()), so that ctrl+C'ing wrangler doesn't kill the browser process, and a new session ID (using setsid()), so that closing the terminal doesn't kill the browser process. It should probably also redirect the browser's stdin/stdout/stderr to /dev/null.
The text was updated successfully, but these errors were encountered:
It's possible that Chrome on Mac behaves differently when run from the command line -- maybe it doesn't block the command line like it does on Linux. Certainly on Windows I'd expect Chrome does not block the command line... but naively I'd expect Mac to behave closer to Linux than to Windows. But anything is possible.
It's also possible that you already have a chrome process running in the background. Even if you close all chrome windows, sometimes it'll leave a process running for the purpose of implementing apps or notifications or some other nutty feature. To see the behavior I'm seeing, you really have to have completely killed Chrome from the background such that wrangler is causing it to start fresh.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
🐛 Bug Report
Environment
rustc -V
: N/Anode -v
: N/Awrangler -V
: 1.2.0Steps to reproduce
wrangler preview --watch
.What did you expect to see?
Wrangler starts the browser, then proceeds to watch for changes to the source code.
What did you see instead?
Wrangler starts the browser, then hangs waiting for the browser to exit before it begins watching for changes, defeating the purpose of
--watch
.The problem is that running the browser (e.g. running
google-chrome <url>
on the command line) behaves differently if another browser process is already open or not.When Wrangler opens a preview window by executing the browser, it waits for the process to exit before proceeding. That works fine in the first case but not the second case.
Instead, Wrangler should start the browser process and then not wait for it. Ideally, it would also start the browser in a new process group (using setpgid()), so that ctrl+C'ing wrangler doesn't kill the browser process, and a new session ID (using setsid()), so that closing the terminal doesn't kill the browser process. It should probably also redirect the browser's stdin/stdout/stderr to /dev/null.
The text was updated successfully, but these errors were encountered: