diff options
Diffstat (limited to 'spec/lib/gitlab/popen_spec.rb')
-rw-r--r-- | spec/lib/gitlab/popen_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/lib/gitlab/popen_spec.rb b/spec/lib/gitlab/popen_spec.rb index 891482a5f17..8211806a809 100644 --- a/spec/lib/gitlab/popen_spec.rb +++ b/spec/lib/gitlab/popen_spec.rb @@ -40,6 +40,17 @@ RSpec.describe Gitlab::Popen do it { expect(@output).to include('No such file or directory') } end + context 'non-zero status with a kill' do + let(:cmd) { [Gem.ruby, "-e", "thr = Thread.new { sleep 5 }; Process.kill(9, Process.pid); thr.join"] } + + before do + @output, @status = @klass.new.popen(cmd) + end + + it { expect(@status).to eq(9) } + it { expect(@output).to be_empty } + end + context 'unsafe string command' do it 'raises an error when it gets called with a string argument' do expect { @klass.new.popen('ls', path) }.to raise_error(RuntimeError) |