Support :environment variables with semicolons in their values #4

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
@jkeiser-oc

Allows :environment to be an array as well as tests to verify that :environment behaves as expected in both old and new behaviors. This preserves backwards compatibility with the old path splitting behavior.

Description: right now, Process.create() has no facility to create an environment variable containing a semicolon. This is a common practice in Windows, because it is the path separator. Both PATH and PATHEXT behave this way.

This fails because it splits the value of PATH apart

Process.create(:app_name => 'cmd /c echo %PATH%', :environment => 'A=B;PATH=C:\Windows;D:\Games')
(Fails with EBADARG)

This succeeds with this patch.

Process.create(:app_name => 'cmd /c echo %PATH%', :environment => ['A=B', 'PATH=C:\Windows;D:\Games'])
Prints PATH=C:\Windows;D:\Games

John Keiser
Support environment variables with semicolons
in their values by supporting an array syntax
@djberg96

This comment has been minimized.

Show comment Hide comment
@djberg96

djberg96 Oct 21, 2011

Collaborator

Your description threw me off, but I think I understand what you're trying to do here. I'll mull it over for a bit but I'll probably merge.

Collaborator

djberg96 commented Oct 21, 2011

Your description threw me off, but I think I understand what you're trying to do here. I'll mull it over for a bit but I'll probably merge.

@djberg96

This comment has been minimized.

Show comment Hide comment
@djberg96

djberg96 Jun 7, 2012

I've incorporated these changes into version 0.7.0, currently sitting in the ffi branch. Thanks!

I've incorporated these changes into version 0.7.0, currently sitting in the ffi branch. Thanks!

@djberg96 djberg96 closed this Jan 3, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment