[ruby/prism] Parse tempfile
https://github.com/ruby/prism/commit/31154a389a
This commit is contained in:
parent
7facf23232
commit
886fc69b1c
@ -62,7 +62,7 @@ PRISM_EXPORTED_FUNCTION bool
|
||||
pm_string_mapped_init(pm_string_t *string, const char *filepath) {
|
||||
#ifdef _WIN32
|
||||
// Open the file for reading.
|
||||
HANDLE file = CreateFile(filepath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
HANDLE file = CreateFile(filepath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL);
|
||||
|
||||
if (file == INVALID_HANDLE_VALUE) {
|
||||
return false;
|
||||
@ -156,7 +156,7 @@ PRISM_EXPORTED_FUNCTION bool
|
||||
pm_string_file_init(pm_string_t *string, const char *filepath) {
|
||||
#ifdef _WIN32
|
||||
// Open the file for reading.
|
||||
HANDLE file = CreateFile(filepath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
HANDLE file = CreateFile(filepath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL);
|
||||
|
||||
if (file == INVALID_HANDLE_VALUE) {
|
||||
return false;
|
||||
|
@ -61,6 +61,14 @@ module Prism
|
||||
end
|
||||
end
|
||||
|
||||
def test_parse_tempfile
|
||||
Tempfile.create(["test_parse_tempfile", ".rb"]) do |t|
|
||||
t.puts ["begin\n", " end\n"]
|
||||
t.flush
|
||||
Prism.parse_file(t.path)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_source_file_node(program)
|
||||
|
Loading…
x
Reference in New Issue
Block a user