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

Minor portability improvements to ./bin/dev #98

Merged
merged 1 commit into from
Aug 5, 2022

Conversation

defeated
Copy link
Contributor

@defeated defeated commented Jul 28, 2022

This fixes a couple issues we ran into, using small alpine ruby image under docker, developing locally with docker compose:

  1. use exec to invoke foreman. This ensures the dev script is replaced by the foreman process and signals/interrupts like ctrl+c are handled correctly. Without this, the child foreman processes are not stopped gracefully and the PID file not cleaned up.

  2. replace bash with sh. Alpine Linux (for example) ships with ash (not bash) but includes sh, so this seems like a reasonable choice as "lowest common denominator"


Gist of minimal test case:

https://gist.github.com/defeated/5d1b7469d5fedb6d6b242f141c68c895

env: can't execute 'bash': No such file or directory

use sh as lowest common denominator
@kevynlebouille
Copy link
Contributor

Hi @defeated,
I'm interested to see your docker-composer/Dockerfile. Could-you share your gist?
Thanks

@defeated
Copy link
Contributor Author

@rafaelfranca rafaelfranca merged commit def749d into rails:main Aug 5, 2022
@defeated defeated deleted the patch-1 branch August 5, 2022 23:00
stevenharman added a commit to stevenharman/jsbundling-rails that referenced this pull request Aug 26, 2022
Some distros don't ship with bash, but will have sh.

see also: rails/cssbundling-rails#98
dhh pushed a commit to rails/jsbundling-rails that referenced this pull request Dec 14, 2022
* exec foreman to replace current process

Use `exec` to invoke `foreman` to make sure `bin/dev` is replaced by the `foreman` process. This ensures that `foreman` gets `bin/dev`'s pid (so it's cleaned up properly) and that interrupts and signals (like `ctrl+c`) are handled correctly by `foreman` (to shut down child processes).

* Use sh as least common denominator shell

Some distros don't ship with bash, but will have sh.

see also: rails/cssbundling-rails#98
titan2gman added a commit to titan2gman/jsbundling-rails that referenced this pull request Dec 27, 2022
* exec foreman to replace current process

Use `exec` to invoke `foreman` to make sure `bin/dev` is replaced by the `foreman` process. This ensures that `foreman` gets `bin/dev`'s pid (so it's cleaned up properly) and that interrupts and signals (like `ctrl+c`) are handled correctly by `foreman` (to shut down child processes).

* Use sh as least common denominator shell

Some distros don't ship with bash, but will have sh.

see also: rails/cssbundling-rails#98
smartech7 pushed a commit to smartech7/ruby-js-bundling that referenced this pull request Aug 4, 2023
* exec foreman to replace current process

Use `exec` to invoke `foreman` to make sure `bin/dev` is replaced by the `foreman` process. This ensures that `foreman` gets `bin/dev`'s pid (so it's cleaned up properly) and that interrupts and signals (like `ctrl+c`) are handled correctly by `foreman` (to shut down child processes).

* Use sh as least common denominator shell

Some distros don't ship with bash, but will have sh.

see also: rails/cssbundling-rails#98
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants