Skip to content
Browse files

Add a wrapper script for runit.

  • Loading branch information...
1 parent c5455cc commit f68bd1caf467c4da5bcfbb9896bba3516e12fef8 @roidrage roidrage committed
Showing with 22 additions and 0 deletions.
  1. +22 −0 worker_host/travis_worker/files/default/signal_wrapper.rb
View
22 worker_host/travis_worker/files/default/signal_wrapper.rb
@@ -0,0 +1,22 @@
+#!/usr/bin/env ruby
+
+if ARGV.empty?
+ puts "Requires at least one argument"
+ exit 1
+end
+
+child_pid = nil
+
+%w{INT TERM CONT}.each do |signal|
+ trap signal do
+ puts "Terminating child"
+ Process.kill(:TERM, child_pid)
+ exit
+ end
+end
+
+child_pid = Kernel.fork do
+ Process.exec(*ARGV)
+end
+
+Process.wait(child_pid)

0 comments on commit f68bd1c

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