Skip to content

Conversation

@mashhurs
Copy link
Contributor

@mashhurs mashhurs commented Oct 29, 2025

Fixes the Errno::ENOENT: No such file or dirirectory error: https://app.travis-ci.com/github/logstash-plugins/logstash-output-csv/jobs/635452763#L650

@mashhurs mashhurs requested a review from donoghuc October 29, 2025 22:24
@mashhurs mashhurs self-assigned this Oct 29, 2025
Copy link
Contributor

@donoghuc donoghuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is certainly the bug! Arguably it would be more "core" rspec to use around

around(:each) do |example|
  Tempfile.create('logstash-spec-output-csv') do |f|
    @tmpfile = f
    example.run
  end
end

let(:tmpfile_path) { @tmpfile.path } 

That would trigger all the Tempfile cleanup in its native block form.

But i dont think its necessarily worth doing that given what you have here fixes the bug and is readable :)


subject { described_class.new(options) }

let(:tmpfile) { Tempfile.new('logstash-spec-output-csv').path }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah looks like the bug was that the a new Tempfile was created (side effect of actually making the file) but there was no reference to it because this was simply reference to the path. So it was free to be cleaned up. Keeping the reference to the Tempfile object should solve it.

Refine the comment for better understanding.

Co-authored-by: Cas Donoghue <cas.donoghue@gmail.com>
@mashhurs mashhurs merged commit 524b6e1 into logstash-plugins:main Oct 29, 2025
2 of 3 checks passed
@mashhurs mashhurs deleted the fix-no-file-or-dir-ci-error branch October 29, 2025 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants