mirror of
https://github.com/ruby/ruby.git
synced 2025-09-19 18:43:59 +02:00
* process.c (proc_exec_v, proc_spawn_v): try to execute with sh if
no shebang. [ruby-core:32745] [EXPERIMENTAL] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ee388f6ee2
commit
d0553ffbb5
4 changed files with 55 additions and 7 deletions
|
@ -1220,4 +1220,18 @@ class TestProcess < Test::Unit::TestCase
|
|||
assert(status.success?, "[ruby-dev:38105]")
|
||||
}
|
||||
end
|
||||
|
||||
def test_fallback_to_sh
|
||||
feature = '[ruby-core:32745]'
|
||||
with_tmpchdir do |d|
|
||||
open("tmp_script.#{$$}", "w") {|f| f.puts ": ;"; f.chmod(0755)}
|
||||
assert_not_nil(pid = Process.spawn("./tmp_script.#{$$}"), feature)
|
||||
wpid, st = Process.waitpid2(pid)
|
||||
assert_equal([pid, true], [wpid, st.success?], feature)
|
||||
|
||||
open("tmp_script.#{$$}", "w") {|f| f.puts "echo $#: $@"; f.chmod(0755)}
|
||||
result = IO.popen(["./tmp_script.#{$$}", "a b", "c"]) {|f| f.read}
|
||||
assert_equal("2: a b c\n", result, feature)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue