<commit_before>require 'rails_helper'

RSpec.describe Syscall, type: :model do

  before(:each) do
    allow(Rails.logger).to receive(:debug).and_return(true)
  end

  describe '#execute' do

    it 'executes the provided command' do
      output = Syscall.execute('uname')
      expect(output).to_not be_empty
    end

    it 'returns the output' do
      output = Syscall.execute('ls')
      expect(output).to_not be_empty
      expect(output).to match(/public/)
    end

    it 'uses the provided directory to run the command' do
      output = Syscall.execute('ls', dir: '/')
      expect(output).to_not be_empty
      expect(output).to match(/root/)
    end

    it 'raises on non-existing command' do
      expect { Syscall.execute('xyz') }.to raise_error(RuntimeError, /xyz: command not found/)
    end

    it 'raises on non-zero exit code' do
      expect { Syscall.execute('ls /no') }.to raise_error(RuntimeError, /cannot access \/no/)
    end

  end

end
<commit_msg>fix test on sh shell<commit_after>require 'rails_helper'

RSpec.describe Syscall, type: :model do

  before(:each) do
    allow(Rails.logger).to receive(:debug).and_return(true)
  end

  describe '#execute' do

    it 'executes the provided command' do
      output = Syscall.execute('uname')
      expect(output).to_not be_empty
    end

    it 'returns the output' do
      output = Syscall.execute('ls')
      expect(output).to_not be_empty
      expect(output).to match(/public/)
    end

    it 'uses the provided directory to run the command' do
      output = Syscall.execute('ls', dir: '/')
      expect(output).to_not be_empty
      expect(output).to match(/root/)
    end

    it 'raises on non-existing command' do
      expect { Syscall.execute('xyz') }.to raise_error(RuntimeError, /not found/)
    end

    it 'raises on non-zero exit code' do
      expect { Syscall.execute('ls /no') }.to raise_error(RuntimeError, /cannot access \/no/)
    end

  end

end

{'fraction_non_alphanumeric': 0.11538461538461539, 'fraction_numerical': 0.0, 'mean_word_length': 2.925553319919517, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2616354', 'n_tokens_mistral': 643, 'n_tokens_neox': 593, 'n_words': 182}