ocrd-website
ocrd-website copied to clipboard
Auto-regeneration does not work on Ubuntu 18.04 WSL 2 - version
Problem
Running make serve under Ubuntu 18.04 with WSL 2 (did not test for WSL 1) will break auto-regeneration:
Auto-regeneration may not work on some Windows versions.
Please see: https://github.com/Microsoft/BashOnWindows/issues/216
If it does not work, please upgrade Bash on Windows or run Jekyll with --no-watch.
Proposed solution
This works for me: https://github.com/jekyll/jekyll/issues/5462#issuecomment-253982908 (change one line in vendor\bundle\ruby\2.5.0\gems\jekyll-4.2.2\lib\jekyll\commands\build.rb)
But I don't know if that will break something for other (non-WSL) versions.
Since make serve is mostly for our own usage, I see no reason not to include that hack. However, the workaround is 6 years old and does not seem to apply in my installation, i.e. the relevant part of my vendor/bundle/ruby/2.5.0/gems/jekyll-4.2.2/lib/jekyll/commands/build.rb looks like this:
if Utils::Platforms.bash_on_windows?
Jekyll.logger.warn "",
"Auto-regeneration may not work on some Windows versions."
Jekyll.logger.warn "",
"Please see: https://github.com/Microsoft/BashOnWindows/issues/216"
Jekyll.logger.warn "",
"If it does not work, please upgrade Bash on Windows or "\
"run Jekyll with --no-watch."
end
External.require_with_graceful_fail "jekyll-watch"
Jekyll::Watcher.watch(options, site)
AFAICS, the if-clause only outputs warnings but doesn't change anything.
Also, changing the source code of a gem will require rebuilding the Gemfile.lock and is generally non-trivial to automate.
Maybe instead, you could add documentation to the README?
Indeed, the (no-op) warnings are gone in the newest release: https://github.com/jekyll/jekyll/pull/8821/files
AFAICS, the if-clause only outputs warnings but doesn't change anything.
I thought that too when I looked at the lines but somehow there actually was a difference. Maybe I just have to retest.
Of course, there was something odd when I originally tested.
What works for me instead, is adding --force_polling \ as a parameter for serve in the Makefile (line 122-128).
Are there any objections to do that? If not, I can make a PR.
If --force-polling solves the problem for you, then sure, add it to the Makefile. You can also directly push it to master, no need for a PR. It's probably a bit less efficient in Linux which doesn't require polling but it's more important that it works for you.