Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: JRuby 1.1.5
-
Fix Version/s: None
-
Component/s: Windows
-
Labels:None
-
Environment:Windows XP
-
Number of attachments :
Description
I have some ruby code that invokes an external program I wrote in Delphi to set an environment variable in windows (by modifying the Windows registry) so that there's no need to reboot.
Typical usage is
result = `setenv #{envName} \"#{envValue}\"`
(NB the escaped double quotes are just used to ensure that the second argument, which may have spaces, is seen as a single parameter)
This works perfectly fine in ruby 1.8
However, if I compile the code to a jruby class and run it, I find that path separators contained within the envValue (such as one would see if setting the PATH) are completely lost. Note that escaping the path separator with another backslash does not work...ALL the backslashes get lost. This was easily confirmed by having my Delphi program write the incoming arguments to STDERR
My workaround was to convert all path separators found in envValue to a different character not allowed in Windows paths and then my Delphi program undoes that change before setting the environment variable. Obviously, this workaround is not a general solution (but it lets me keep going ![]()
Activity
| Field | Original Value | New Value |
|---|---|---|
| Component/s | Windows [ 13600 ] | |
| Component/s | Core Classes/Modules [ 12230 ] |
| Description |
I have some ruby code that invokes an external program I wrote in Delphi to set an environment variable in windows (by modifying the Windows registry) so that there's no need to reboot. Typical usage is result = `setenv #{envName} \"#{envValue}\"` (NB the escaped double quotes are just used to ensure that the second argument, which may have spaces, is seen as a single parameter) This works perfectly fine in ruby 1.8 However, if I compile the code to a jruby class and run it, I find that path separators contained within the envValue (such as one would see if setting the PATH) are completely lost. Note that escaping the path separator with another backslash does not work...ALL the backslashes get lost. This was easily confirmed by having my Delphi program write the incoming arguments to STDERR My workaround was to convert all path separators found in envValue to a different character not allowed in Windows paths and then my Delphi program undoes that change before setting the environment variable. Obviously, this workaround is not a general solution (but it lets me keep going :-) |
I have some ruby code that invokes an external program I wrote in Delphi to set an environment variable in windows (by modifying the Windows registry) so that there's no need to reboot.
Typical usage is {noformat} result = `setenv #{envName} \"#{envValue}\"` {noformat} (NB the escaped double quotes are just used to ensure that the second argument, which may have spaces, is seen as a single parameter) This works perfectly fine in ruby 1.8 However, if I compile the code to a jruby class and run it, I find that path separators contained within the envValue (such as one would see if setting the PATH) are completely lost. Note that escaping the path separator with another backslash does not work...ALL the backslashes get lost. This was easily confirmed by having my Delphi program write the incoming arguments to STDERR My workaround was to convert all path separators found in envValue to a different character not allowed in Windows paths and then my Delphi program undoes that change before setting the environment variable. Obviously, this workaround is not a general solution (but it lets me keep going :-) |