childprocess 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77e7009c5202bfecb17e331b56d15c79b92d33b0
4
- data.tar.gz: 343d119d1130d05fe395d5ee2631aeb1a50866a0
3
+ metadata.gz: 5ff6c21571973bc86342b2e8f604487ead0ac6d5
4
+ data.tar.gz: f6603ff7e7c6244d3f740a045b505e5b2b7f4d9e
5
5
  SHA512:
6
- metadata.gz: f84deda774210ec0d133c08095389c212770ed6afa58b37bddef82a7ca0513e76fcdcd3aaeb0ea4ca0e878329c160a7d9ba4770f19faceb472d9dbe9333cc45a
7
- data.tar.gz: 7ded6c7fa7364c4c5fe423c7a06e671dce947e6290e62fb3d4be7d62554be1339e0e706159ee9fc4350c0a3a1fc4f5f608122c2c281780485793523d42dcfb5f
6
+ metadata.gz: e275ff71f12bef3f8fc39657bfa4bd1ac350bcd98fadd1dc12794da8abf62d83acda8b21e244acfefa5f11c42937792e1d7b3b23cbcd97d5ecaf4aa77e7d13e0
7
+ data.tar.gz: c3ed5e6312b4457066585d02487b7bbf7a887702a89ea66bfc99f9bc3710e37d4c25a92af6496cf4ddbc1311035102bf975b2627e0d3417fd9e2fc774a4e2f7e
@@ -113,13 +113,20 @@ module ChildProcess
113
113
  end
114
114
 
115
115
  def set_env(env)
116
- ENV.to_hash.merge(@environment).each do |k,v|
116
+ merged = ENV.to_hash
117
+
118
+ @environment.each { |k, v| merged[k.to_s] = v }
119
+
120
+ merged.each do |k, v|
117
121
  if v
118
- env.put(k.to_s, v.to_s)
119
- else
120
- env.remove(k.to_s) if env.key?(k.to_s)
122
+ env.put(k, v.to_s)
123
+ elsif env.has_key? k
124
+ env.remove(k)
121
125
  end
122
126
  end
127
+
128
+ removed_keys = env.key_set.to_a - merged.keys
129
+ removed_keys.each { |k| env.remove(k) }
123
130
  end
124
131
 
125
132
  def create_stdin
@@ -1,3 +1,3 @@
1
1
  module ChildProcess
2
- VERSION = "0.5.4"
2
+ VERSION = "0.5.5"
3
3
  end
@@ -124,6 +124,19 @@ describe ChildProcess do
124
124
  end
125
125
  end
126
126
 
127
+ it 'does not see env vars unset in parent' do
128
+ Tempfile.open('env-spec') do |file|
129
+ ENV['CHILDPROCESS_UNSET'] = nil
130
+ process = write_env(file.path)
131
+ process.start
132
+
133
+ process.wait
134
+
135
+ child_env = eval rewind_and_read(file)
136
+ expect(child_env).to_not have_key('CHILDPROCESS_UNSET')
137
+ end
138
+ end
139
+
127
140
 
128
141
  it "passes arguments to the child" do
129
142
  args = ["foo", "bar"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: childprocess
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jari Bakken
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-30 00:00:00.000000000 Z
11
+ date: 2014-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec