From: Eric Wong <e@80x24.org>
To: yahns-public@yhbt.net
Subject: [PATCH] test_bin: use RbConfig.ruby for non-standard names
Date: Thu, 6 Apr 2017 05:11:58 +0000 [thread overview]
Message-ID: <20170406051158.27624-1-e@80x24.org> (raw)
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+)
---
test/test_bin.rb | 7 +++----
1 file 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 @@ def test_listen_fd3
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 @@ def usr2_dir(tmpdir, preload, worker)
# 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)
}
--
EW
reply other threads:[~2017-04-06 5:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://yhbt.net/yahns/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170406051158.27624-1-e@80x24.org \
--to=e@80x24.org \
--cc=yahns-public@yhbt.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhbt.net/yahns.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).