Merge pull request #14879 from scpeters/max_open_files_message

lock_file: better message if too many open files
This commit is contained in:
Mike McQuaid 2023-03-07 09:30:21 +00:00 committed by GitHub
commit 0209ba1cd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,7 +42,11 @@ class LockFile
def create_lockfile
return if @lockfile.present? && !@lockfile.closed?
@lockfile = @path.open(File::RDWR | File::CREAT)
begin
@lockfile = @path.open(File::RDWR | File::CREAT)
rescue Errno::EMFILE
odie "The maximum number of open files on this system has been reached. Use `ulimit -n` to increase this limit."
end
@lockfile.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
end
end