diff --git a/lib/gitlab/popen.rb b/lib/gitlab/popen.rb
index d10269f44380ecfdfd1a660ea3395f1cb405b1f6..f9559012c4a43fa18b6d41499bb0bb98ec3007cc 100644
--- a/lib/gitlab/popen.rb
+++ b/lib/gitlab/popen.rb
@@ -3,11 +3,12 @@ require 'open3'
 
 module Gitlab
   module Popen
-    def popen(cmd, path)
+    def popen(cmd, path=nil)
       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 }
 
diff --git a/spec/lib/gitlab/popen_spec.rb b/spec/lib/gitlab/popen_spec.rb
index a4a0846b7b9f473d3ad2ffe1b4216df721bb75a8..76d506eb3c0bf385fbba06d42e3f935f90e9bef1 100644
--- a/spec/lib/gitlab/popen_spec.rb
+++ b/spec/lib/gitlab/popen_spec.rb
@@ -32,5 +32,14 @@ describe 'Gitlab::Popen', no_db: true do
     end
   end
 
+  context 'without a directory argument' do
+    before do
+      @output, @status = @klass.new.popen(%W(ls))
+    end
+
+    it { @status.should be_zero }
+    it { @output.should include('spec') }
+  end
+
 end