Apparently, Win95 does not support file associations from the command line.
The following fails on Win95:
require 'runit/testcase'
require 'runit/cui/testrunner'
class POpenTest < RUNIT::TestCase
def setup
tmpdir=ENV['TMPDIR']||ENV['TMP']||ENV['TEMP']||'/tmp'
@testfilename = tmpdir + '/testfile.rb'
@testoutput = 'blargh'
testfile = File.new(@testfilename, File::CREAT|File::TRUNC|File::RDWR)
testfile << 'print "' + @testoutput + '"'
testfile.close
end
def teardown
File.delete(@testfilename)
end
def testpopen
f = IO.popen(@testfilename)
# f = IO.popen('ruby ' + @testfilename) -- this works
assert_equal(@testoutput, f.read)
end
end
RUNIT::CUI::TestRunner.run(POpenTest.suite)
... even though .rb files are associated to ruby.exe. I can execute a .rb
file from Explorer (double-click) or from the Start|Run... dialog. But from
the command line (DOS box), it shrugs its shoulders.
First question, does anyone know a way to get this to work in 95? I assume
it's Just The Way It Is.
Second question, what's a good workaround? One thought I'd had was to add
code to check for a shebang #! at the top of the file and explicitly execute
that in the popen call.
What I'm shooting for is a way to get .rb files to be executed as a cgi
program on 95 -- I don't want to hardcode ruby as the executioner(? <g>) to
allow for other cgi source.
Chris