Upgrade to childprocess 0.2.3 and remove our hacky with_env_changes

This commit is contained in:
Mitchell Hashimoto 2011-11-27 16:11:07 -07:00
parent 0279cc1edf
commit 27c4d61e67
2 changed files with 7 additions and 27 deletions

View File

@ -68,11 +68,13 @@ module Acceptance
process.io.stderr = stderr_writer
process.duplex = true
@env.each do |k, v|
process.environment[k] = v
end
Dir.chdir(@workdir.to_s) do
with_env_changes do
process.start
process.io.stdin.sync = true
end
process.start
process.io.stdin.sync = true
end
# Close our side of the pipes, since we're just reading
@ -189,28 +191,6 @@ module Acceptance
return @apps[command] if @apps.has_key?(command)
return command
end
# This method changes the environmental variables of the process to
# that of this environment, yields, and then resets them. This allows
# us to change the environment temporarily.
#
# NOTE: NOT threadsafe.
def with_env_changes
stashed = {}
begin
@env.each do |key, value|
stashed[key] = ENV[key]
ENV[key] = value
end
yield
ensure
stashed.each do |key, value|
ENV[key] = stashed[key]
end
end
end
end
# This class represents a process which has run via the IsolatedEnvironment.

View File

@ -28,7 +28,7 @@ Gem::Specification.new do |s|
s.add_development_dependency "log4r", "~> 1.1.9"
s.add_development_dependency "minitest", "~> 2.5.1"
s.add_development_dependency "mocha"
s.add_development_dependency "childprocess", "~> 0.2.2"
s.add_development_dependency "childprocess", "~> 0.2.3"
s.add_development_dependency "sys-proctable", "~> 0.9.0"
s.add_development_dependency "rspec-core", "~> 2.7.1"
s.add_development_dependency "rspec-expectations", "~> 2.7.0"