Commit e7ec75ee authored by Marius Rackwitz's avatar Marius Rackwitz

[PodSourcePreparer] Don't leak version var on failure

parent eb142cb2
......@@ -58,15 +58,18 @@ module Pod
return unless spec.prepare_command
UI.section(' > Running prepare command', '', 1) do
Dir.chdir(path) do
begin
ENV.delete('CDPATH')
ENV['COCOAPODS_VERSION'] = Pod::VERSION
prepare_command = spec.prepare_command.strip_heredoc.chomp
full_command = "\nset -e\n" + prepare_command
bash!('-c', full_command)
ensure
ENV.delete('COCOAPODS_VERSION')
end
end
end
end
#-----------------------------------------------------------------------#
end
......
......@@ -63,6 +63,13 @@ module Pod
@spec.prepare_command = "[ \"$COCOAPODS_VERSION\" == \"#{Pod::VERSION}\" ] || exit 1"
lambda { @installer.install! }.should.not.raise
end
it 'doesn\'t leak the $COCOAPODS_VERSION environment variable' do
ENV['COCOAPODS_VERSION'] = nil
@spec.prepare_command = 'exit 1'
lambda { @installer.install! }.should.raise(Pod::Informative)
ENV['COCOAPODS_VERSION'].should.be.nil
end
end
#--------------------------------------#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment