Skip to content

Conversation

lovro-bikic
Copy link

Currently, Bundler::Audit::Database#update!, #commit_id and #last_updated_at fail in multi-threaded environments (like background processing jobs) because they use Dir.chdir.

From Ruby docs on Dir.chdir:

In a multi-threaded program an error is raised if a thread attempts to open a chdir block while another thread has one open, or a call to chdir without a block occurs inside a block passed to chdir (even in the same thread).

This PR removes the need for Dir.chdir by using Open3.capture2 from the stdlib with the chdir option.

External behavior should stay the same: Dir.chdir raises an Errno::ENOENT error given an non-existent directory, and the same holds with the new implementation.

Fixes #156

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.

Bundler audit is not thread safe
1 participant