about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2017-04-06 05:11:58 +0000
committerEric Wong <yahns-public@yhbt.net>2017-04-06 06:47:35 +0000
commitf76ff00466e679e367713bc6345d0a95191629cd (patch)
tree453a65b6550d88c54b96e7c5439d0f3970a2f577
parent845aacc83721e888a6893ba863c6406e2528143d (diff)
downloadyahns-f76ff00466e679e367713bc6345d0a95191629cd.tar.gz
It's possible to have "ruby" executables by other names
(e.g. "ruby24"), so use a supported API for finding our
executable.

This feature was added in Ruby 1.9.2, so it's safe to use
as we've always been 1.9.3+ (and nowadays 2.0+)
-rw-r--r--test/test_bin.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/test/test_bin.rb b/test/test_bin.rb
index af990ad..579e39c 100644
--- a/test/test_bin.rb
+++ b/test/test_bin.rb
@@ -9,7 +9,7 @@ class TestBin < Testcase
 
   def setup
     server_helper_setup
-    @cmd = %W(ruby -I lib bin/yahns)
+    @cmd = %W(#{RbConfig.ruby} -I lib bin/yahns)
   end
 
   def test_listen_fd3
@@ -19,7 +19,7 @@ class TestBin < Testcase
 
     ru = tmpfile(%w(test_bin_daemon .ru))
     ru.write("require 'rack/lobster'; run Rack::Lobster.new\n")
-    cmd = %W(ruby -I lib bin/yahns-rackup
+    cmd = %W(#{RbConfig.ruby} -I lib bin/yahns-rackup
              -E none -p #{port} -o #{host} #{ru.path})
     pid = fork do # emulate a systemd environment
       env = {
@@ -159,10 +159,9 @@ class TestBin < Testcase
     # other processes which fork (but do not exec), causing ETXTBUSY on
     # Process.spawn
     pid = fork do
-      ruby = "#!#{`which ruby`}"
       File.open(exe, "w") { |y|
         lines = File.readlines("bin/yahns")
-        lines[0] = ruby
+        lines[0] = "#!#{RbConfig.ruby}\n"
         y.chmod(0755)
         y.syswrite(lines.join)
       }