@@ -140,10 +140,10 @@ if $cpid == 0
140140 link_swdir.call swdir, Pathname.new('')
141141
142142 # New environment
143− ENV.replace(Hash[ envvars.map { |x| [x, ENV[x]] } ])
143+ new_env = Hash[ envvars.map { |x| [x, ENV[x]] } ]
144144
145145 # Finally, exec!
146− exec *execp
146+ exec(new_env, *execp, close_others: true, unsetenv_others: true)
147147end
148148
149149# Wait for a child. If we catch a signal, resend it to child and continue