| Message: 98462 |
 |
BY: Svetlana Roshenko (slackfan) DATE: 2012-10-12 23:13 SUBJECT: RE: Process.create( and the environment param Hi,
i am sorry for the rape of this dead thread but I can't get this working too and if I understand the current code correctly it still does not work.
Code from process.rb currently says
if hash['environment']
env = hash['environment'].split(File::PATH_SEPARATOR) << 0.chr
if hash['with_logon']
env = env.map{ |e| multi_to_wide(e) }
env = [env.join("\0\0")].pack('p*').unpack('L').first
else
env = [env.join("\0")].pack('p*').unpack('L').first
end
else
env = nil
end
This means that applying an environment with key "Path" and value "C:\foo;C:\bar" will never work properly.
Why
.split(File::PATH_SEPARATOR)
and not
.split(0.chr)
? Any advice would be really helpful :)
A test script could be
require 'win32/process'
process_info = Process.create(
:app_name => ENV['ComSpec'].dup,
:creation_flags => Windows::Process::CREATE_NEW_CONSOLE,
:process_inherit => false,
:thread_inherit => true,
:cwd => "C:\\",
:environment => 'Foo=C:\bar;C:\baz'
)
Process.detach(process_info[:process_id])
| |