jekyll/jekyll

[Bug]: jekyll serve does not detach when spawned without shell

thekief opened this issue ยท 2 comments

Operating System

Ubuntu 22.04.3 LTS

Ruby Version

ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux-gnu]

Jekyll Version

jekyll-4.3.2

GitHub Pages Version

No response

Expected Behavior

Once the command

bundle exec jekyll serve --detach --config _config.yml,pdf/assets/config_pdf.yml

outputs

Server detached with pid '3816'. Run `pkill -f jekyll' or `kill -9 3816' to stop the server.

the process successfully detaches.

Current Behavior

I use an application to modify some files and eventually start jekyll, using the command

bundle exec jekyll serve --detach --config _config.yml,pdf/assets/config_pdf.yml

I had to add some stages after the spawn and noticed that the commands seems to hang. I had two implementations, one in Swift using ShellOut [1] and one in Rust [2] using cmd_lib. The above behaviour is replicable in both implementations.

[1] https://github.com/JohnSundell/ShellOut
[2] https://github.com/rust-shell-script/rust_cmd_lib

Relevant log output

Jekyll Spaceship: ๐Ÿš€ Jekyll-Spaceship 0.10.2
  Jekyll Spaceship: ๐ŸŽ‰ A Jekyll plugin to provide powerful supports.
  Jekyll Spaceship: ๐Ÿ‘‰ https://github.com/jeffreytse/jekyll-spaceship
Configuration file: /doc/stuff/_config.yml
Configuration file: /doc/stuff/pdf/assets/config_pdf.yml
  Jekyll Spaceship: ๐Ÿ—‚  use plantuml-processor
            Source: /doc/stuff
       Destination: /doc/stuff/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
  Jekyll Spaceship: [PlantumlProcessor] docs/stuff.md
[INFO  cmd_lib::child]      Build Warning: Layout 'page_print' requested in assets/js/stuff-docs.js does not exist.
[INFO  cmd_lib::child]      Build Warning: Layout 'page_print' requested in assets/js/zzzz-search-data.json does not exist.
                    done in 0.22 seconds.
 Auto-regeneration: disabled when running server detached.
    Server address: http://127.0.0.1:4010/
Server detached with pid '3816'. Run `pkill -f jekyll' or `kill -9 3816' to stop the server.


```sh
Fetching rake 13.1.0
Installing rake 13.1.0
Fetching public_suffix 5.0.4
Fetching colorator 1.1.0
Fetching concurrent-ruby 1.2.2
Fetching eventmachine 1.2.7
Fetching http_parser.rb 0.8.0
Fetching gemoji 3.0.1
Fetching google-protobuf 3.9.2 (x86_64-linux)
Fetching rb-fsevent 0.11.2
Fetching rouge 4.1.3
Fetching unicode-display_width 2.5.0
Fetching rainbow 3.1.1
Fetching rexml 3.2.6
Fetching liquid 4.0.4
Fetching mercenary 0.4.0
Fetching safe_yaml 1.0.5
Fetching webrick 1.8.1
Fetching racc 1.7.3
Fetching ffi 1.16.3
Fetching forwardable-extended 2.6.0
Installing rainbow 3.1.1
Installing webrick 1.8.1
Installing colorator 1.1.0
Installing mercenary 0.4.0
Installing forwardable-extended 2.6.0
Fetching pathutil 0.16.2
Installing liquid 4.0.4
Installing public_suffix 5.0.4
Installing safe_yaml 1.0.5
Installing unicode-display_width 2.5.0
Installing rb-fsevent 0.11.2
Installing racc 1.7.3 with native extensions
Installing gemoji 3.0.1
Fetching terminal-table 3.0.2
Fetching addressable 2.8.5
Installing rexml 3.2.6
Fetching kramdown 2.4.0
Installing rouge 4.1.3
Installing pathutil 0.16.2
Installing terminal-table 3.0.2
Installing addressable 2.8.5
Fetching nokogiri 1.15.5 (x86_64-linux)
Installing http_parser.rb 0.8.0 with native extensions
Installing eventmachine 1.2.7 with native extensions
Installing kramdown 2.4.0
Installing concurrent-ruby 1.2.2
Fetching i18n 1.14.1
Fetching kramdown-parser-gfm 1.1.0
Installing i18n 1.14.1
Installing kramdown-parser-gfm 1.1.0
Installing google-protobuf 3.9.2 (x86_64-linux)
Installing ffi 1.16.3 with native extensions
Installing nokogiri 1.15.5 (x86_64-linux)
Fetching em-websocket 0.5.3
Installing em-websocket 0.5.3
Fetching sassc 2.4.0
Fetching rb-inotify 0.10.1
Installing rb-inotify 0.10.1
Fetching listen 3.8.0
Installing sassc 2.4.0 with native extensions
Installing listen 3.8.0
Fetching jekyll-watch 2.2.1
Installing jekyll-watch 2.2.1
Fetching jekyll-sass-converter 2.2.0
Installing jekyll-sass-converter 2.2.0
Fetching jekyll 4.3.2
Installing jekyll 4.3.2
Fetching jekyll-spaceship 0.10.2
Installing jekyll-spaceship 0.10.2
Bundle complete! 6 Gemfile dependencies, 37 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

Code Sample

  ...
  run_cmd!(bundle exec jekyll serve --detach --config _config.yml,pdf/assets/config_pdf.yml);
  ...
  ...
  let output = try shellOut(to: [pwd.cd, "bundle exec jekyll serve --detach --config _config.yml,pdf/assets/config_pdf.yml"])
  ...

The root cause was an issue with sass-embedded not handling fork properly, and this should have been fixed by just released 1.69.6.

Closing this since it appears there is a fix availble.