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

serve/watch with --open blocks change watcher #1639

Closed
johannst opened this issue Sep 1, 2021 · 3 comments · Fixed by #1656
Closed

serve/watch with --open blocks change watcher #1639

johannst opened this issue Sep 1, 2021 · 3 comments · Fixed by #1656
Labels
Command-serve Command: serve Command-watch Command: watch

Comments

@johannst
Copy link
Contributor

johannst commented Sep 1, 2021

In case the watch feature is enabled and we run one of the following commands

mdbook serve --open
mdbook watch --open

listening for file changes is blocked until the browser is closed.

Should we open the browser in a separate thread and start listening for changes immediately?

See PR (#1638) for example.

@johannst
Copy link
Contributor Author

As discussed in PR (#1638) we can move to opener, which opens in background by default without waiting for the child process to finish.

I just took another look in open and saw that there is also that_in_background.

Using that_in_background we would need to take care of joining the thread handle.

I can create a new PR, any preference on staying with open or switching to opener?

@ehuss
Copy link
Contributor

ehuss commented Sep 26, 2021

I would probably lean towards using opener. That is what we use in Cargo, so I am more familiar with it from there.

@johannst
Copy link
Contributor Author

Created new PR (#1656), switching to opener.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Command-serve Command: serve Command-watch Command: watch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants