guard/guard-process

How to run 2 commands with a pause between them?

Closed this issue · 2 comments

I would like to run 2 commands with guard-process:

  1. unicorn
  2. curl localhost

Is it possible for the curl to be executed once the unicorn has launched?

Or, is it possible to wait 1 second for the curl to be executed? The following did not work because usage: sleep seconds.

guard :process, name:'Unicorn', command:'unicorn -p 9292' do
  watch(%r{^(.+).rb$})
end

guard :process, name:'Request', command:'sleep 1; curl localhost:9292' do
  watch(%r{^(.+).rb$})
end
e2 commented

@georgeu2000 - you should be able to pass an array or arguments for :command, e.g.

guard :process, name:'Request', command: ['bash', '-c', 'sleep 1; curl localhost:9292'] do

Awesome. Thank you!