Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Comments

  • Loading branch information...
commit fb8a550f0a0b3d583428c6ef635ebdb570961f41 1 parent 31290fc
Winton Welsh authored

Showing 1 changed file with 7 additions and 0 deletions. Show diff stats Hide diff stats

  1. +7 0 lib/with_pid.rb
7 lib/with_pid.rb
@@ -2,16 +2,23 @@
2 2 require 'erb'
3 3
4 4 def with_pid(options)
  5 + # Add pid_dir option
5 6 options[:pid_dir] = File.dirname(options[:pid])
  7 +
  8 + # Render bash script
6 9 template = File.dirname(__FILE__) + '/../templates/bash.erb'
7 10 template = File.expand_path(template)
8 11 template = File.read(template)
9 12 template = ERB.new(template).result(binding)
10 13 bash_path = options[:tmp] + "/" + options[:name]
  14 +
  15 + # Write bash script to tmp
11 16 FileUtils.mkdir_p(options[:tmp])
12 17 File.open(bash_path, 'w') do |f|
13 18 f.write(template)
14 19 end
  20 +
  21 + # Execute bash script
15 22 `chmod +x #{bash_path}`
16 23 `#{bash_path}`
17 24 end

0 comments on commit fb8a550

Please sign in to comment.
Something went wrong with that request. Please try again.