From cc76155bf509587e1b2954e9de77c558c7c857f4 Mon Sep 17 00:00:00 2001 From: Andrew Konchin Date: Mon, 16 Dec 2024 16:47:24 +0200 Subject: [PATCH] Declare `File::SHARE_DELETE` constant Close #3745 --- CHANGELOG.md | 1 + spec/ruby/core/file/constants/constants_spec.rb | 2 +- src/main/ruby/truffleruby/core/file.rb | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3e6eb787870..8c6226975a25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ Compatibility: * Add `Dir.for_fd` (#3681, @andrykonchin). * Add `Dir.fchdir` (#3681, @andrykonchin). * Add `Dir#chdir` (#3681, @andrykonchin). +* Declare `File::SHARE_DELETE` constant (#3745, @andrykonchin). Performance: diff --git a/spec/ruby/core/file/constants/constants_spec.rb b/spec/ruby/core/file/constants/constants_spec.rb index 86946822c56f..bba248c21e20 100644 --- a/spec/ruby/core/file/constants/constants_spec.rb +++ b/spec/ruby/core/file/constants/constants_spec.rb @@ -4,7 +4,7 @@ "FNM_DOTMATCH", "FNM_EXTGLOB", "FNM_NOESCAPE", "FNM_PATHNAME", "FNM_SYSCASE", "LOCK_EX", "LOCK_NB", "LOCK_SH", "LOCK_UN", "NONBLOCK", "RDONLY", - "RDWR", "TRUNC", "WRONLY"].each do |const| + "RDWR", "TRUNC", "WRONLY", "SHARE_DELETE"].each do |const| describe "File::Constants::#{const}" do it "is defined" do File::Constants.const_defined?(const).should be_true diff --git a/src/main/ruby/truffleruby/core/file.rb b/src/main/ruby/truffleruby/core/file.rb index b814fa9e1ff4..eb70712b40e9 100644 --- a/src/main/ruby/truffleruby/core/file.rb +++ b/src/main/ruby/truffleruby/core/file.rb @@ -82,6 +82,8 @@ module Constants NONBLOCK = Truffle::Config['platform.file.O_NONBLOCK'] SYNC = Truffle::Config['platform.file.O_SYNC'] + SHARE_DELETE = 0 # a pseudo file mode flag that's meaningful only on Windows + if value = Truffle::Config.lookup('platform.file.O_TMPFILE') TMPFILE = value end