"Erik Veenstra" <pan@erikveen.dds.nl> writes:
How about using something like this in your FreePascal
program:
Exec(GetEnv('COMSPEC'), '/C "set RUPYOPT=& \path\to\ruby
..."')
This uses the system command processor to execute the
following two commands (the ampersand is a command
separator):
On Windows 2000:
S:\>echo 1&echo 2
1
2
On Windows 98:
S:\>echo 1&echo 2
1&echo 2
That's not gonna work...
Thanks.
Oh well ... [sigh]
You seem to have some rather restrictive constraints:
- This must run under FreePascal, a language which doesn't
seem to offer anything like setenv.
- This must not make use of any auxiliary .BAT files.
- This has to run under Windows 98.
Combining these limitations with the fact that ruby doesn't seem to
offer a way to ignore RUBYOPT, then it appears like you're stuck with
having to use some sort of ugly work-around, such as the nested ruby
solutions mentioned earlier.
In other words, it seems to be that your only option is to choose which
form of ugliness offends you the least.
Here's yet another piece of ugliness to consider:
I know you said no .BAT files, but would it fit within your restrictive
constraints to just create a temporary .BAT file, execute it, and then
delete it right away? Or is that also beyond the pale in your execution
environment?
If this is feasible, you can put this logic into your FreePascal
program:
Open a file named "xxxxxxxx.bat" for writing, where "xxxxxxxx"
is a unique string of valid filename characters.
Write the following into that file:
@echo off
set RUBYOPT=
\path\to\ruby program args ...
Close the file
Invoke this command:
Exec(GetEnv('COMSPEC'), '/C call xxxxxxxx.bat')
Delete "xxxxxxxx.bat"
This is no uglier than those nested ruby suggestions.
···
--
Lloyd Zusman
ljz@asfast.com
God bless you.