lib/bluepill/process.rb in bluepill-0.0.7 vs lib/bluepill/process.rb in bluepill-0.0.8
- old
+ new
@@ -246,11 +246,11 @@
self.skip_ticks_for(start_grace_time)
end
def stop_process
if stop_command
- cmd = stop_command.to_s.gsub("{{PID}}", actual_pid.to_s)
+ cmd = process_command(stop_command)
logger.warning "Executing stop command: #{cmd}"
result = System.execute_blocking(cmd, :uid => self.uid, :gid => self.gid)
unless result[:exit_code].zero?
logger.warning "Stop command execution returned non-zero exit code:"
@@ -268,11 +268,13 @@
def restart_process
if restart_command
logger.warning "Executing restart command: #{restart_command}"
- result = System.execute_blocking(restart_command, :uid => self.uid, :gid => self.gid)
+ cmd = process_command(restart_command)
+ result = System.execute_blocking(cmd, :uid => self.uid, :gid => self.gid)
+
unless result[:exit_code].zero?
logger.warning "Restart command execution returned non-zero exit code:"
logger.warning result.inspect
end
@@ -361,9 +363,13 @@
end
end
def deep_copy
Marshal.load(Marshal.dump(self))
+ end
+
+ def process_command(cmd)
+ cmd.to_s.gsub("{{PID}}", actual_pid.to_s)
end
end
end
\ No newline at end of file