summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-07-03 04:07:44 -0700
committerStan Hu <stanhu@gmail.com>2017-07-03 04:07:44 -0700
commit58e9be979471adc69bf810a9e1c9b696bd760a29 (patch)
treea0ab21b6d3edb0a6b1324680fa8fd7ccfee30645
parentb6a4ce1d0255d702b3cc001653d3725888967cf5 (diff)
downloadgitlab-ce-sh-optimize-project-creation.tar.gz
Revert changes no longer necessary in lib/gitlab/popen.rbsh-optimize-project-creation
-rw-r--r--lib/gitlab/popen.rb4
-rw-r--r--spec/lib/gitlab/popen_spec.rb4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/gitlab/popen.rb b/lib/gitlab/popen.rb
index 66ed580ed30..4bc5cda8cb5 100644
--- a/lib/gitlab/popen.rb
+++ b/lib/gitlab/popen.rb
@@ -5,14 +5,14 @@ module Gitlab
module Popen
extend self
- def popen(cmd, path = nil, vars = {}, options = {})
+ def popen(cmd, path = nil, vars = {})
unless cmd.is_a?(Array)
raise "System commands must be given as an array of strings"
end
path ||= Dir.pwd
vars['PWD'] = path
- options[:chdir] ||= path
+ options = { chdir: path }
unless File.directory?(path)
FileUtils.mkdir_p(path)
diff --git a/spec/lib/gitlab/popen_spec.rb b/spec/lib/gitlab/popen_spec.rb
index a7098da6e49..af50ecdb2ab 100644
--- a/spec/lib/gitlab/popen_spec.rb
+++ b/spec/lib/gitlab/popen_spec.rb
@@ -34,12 +34,12 @@ describe 'Gitlab::Popen', lib: true, no_db: true do
context 'with custom options' do
let(:vars) { { 'foobar' => 123, 'PWD' => path } }
- let(:options) { { opt_test: 456 } }
+ let(:options) { { chdir: path } }
it 'calls popen3 with the provided environment variables' do
expect(Open3).to receive(:popen3).with(vars, 'ls', options)
- @output, @status = @klass.new.popen(%w(ls), path, { 'foobar' => 123 }, options)
+ @output, @status = @klass.new.popen(%w(ls), path, { 'foobar' => 123 })
end
end