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

Running two commands (bundle && rails s) #111

Closed
jmuheim opened this issue Jan 11, 2017 · 3 comments
Closed

Running two commands (bundle && rails s) #111

jmuheim opened this issue Jan 11, 2017 · 3 comments

Comments

@jmuheim
Copy link

jmuheim commented Jan 11, 2017

I have the following rerun command:

rerun --pattern '{Gemfile.lock,bin/server,config/application.rb...}' --no-notify --signal INT --background --clear -- rails s -b 0.0.0.0

Sometimes rerun is triggered because the Gemfile changes; and then sometimes it's because a new gem was added which isn't installed yet.

For this, I'd like not to only run rails s but bundle && rails s.

rerun --pattern '{Gemfile.lock,bin/server,config/application.rb...}' --no-notify --signal INT --background --clear -- bundle && rails s -b 0.0.0.0

Sadly, this doesn't work for me:

...
Using compass-rails 3.0.2
Using rails_admin 1.1.1
Bundle complete! 82 Gemfile dependencies, 191 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

13:27:49 [rerun] Src Launch Failed
13:27:49 [rerun] Watching . for {Gemfile.lock,bin/server,config/application.rb,config/environment.rb,config/environments/development.rb,config/initializers/*.rb,lib/**/*.rb,config/database.yml,config/boot.rb}

Then nothing happens anymore.

Interestingly, when I hit Ctrl+C, it proceeds like this:

^C
13:28:11 [rerun] Src stopping
13:28:11 [rerun] Sending signal INT to 61796
=> Booting Puma
=> Rails 5.0.1 application starting in development on http://0.0.0.0:3001
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.6.2 (ruby 2.2.6-p396), codename: Sleepy Sunday Serenity
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3001
Use Ctrl-C to stop

So maybe there's another way to execute two commands in a row?

@elbuki
Copy link

elbuki commented Sep 9, 2017

My solution is creating a shell script, then add all the commands that you want to be run in there and invoke it into the rerun command, like this.

rerun --background --pattern="**/*.{rb}" --dir bin,src "./bin/reload"'

@jmuheim
Copy link
Author

jmuheim commented Sep 9, 2017

That's a very cool suggestion. Thanks!

@alexch
Copy link
Owner

alexch commented Jan 24, 2018

More detail: && is a shell operator, but rerun works below the shell, directly on processes, so it can't do command pipes like that.

@alexch alexch closed this as completed Jan 24, 2018
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

No branches or pull requests

3 participants