Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread
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])


Thread View

Thread Author Date
Process.create( and the environment parameterGavin Jefferies2009-02-01 00:33
      RE: Process.create( and the environment parameterDaniel Berger2009-02-02 04:47
            RE: Process.create( and the environment paramGavin Jefferies2009-02-02 05:34
                  RE: Process.create( and the environment paramDaniel Berger2009-02-11 20:49
                        RE: Process.create( and the environment paramSvetlana Roshenko2012-10-12 23:13
                              RE: Process.create( and the environment paramDaniel Berger2012-10-19 04:43

Post a followup to this message