mirror of
https://github.com/tree-sitter/tree-sitter.git
synced 2026-09-10 07:36:22 -04:00
fix(rust): pass correct fd to C lib's ts_tree_print_dot_graph
Co-authored-by: Amaan Qureshi <git@amaanq.com>
(cherry picked from commit 92678f0fc5)
This commit is contained in:
parent
9275aeba08
commit
f75d710ec6
|
|
@ -87,7 +87,6 @@ fn test_parsing_with_logging() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_parsing_with_debug_graph_enabled() {
|
||||
use std::io::{BufRead, BufReader, Seek};
|
||||
|
||||
|
|
|
|||
|
|
@ -1441,6 +1441,11 @@ impl Drop for Parser {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
extern "C" {
|
||||
fn _open_osfhandle(osfhandle: isize, flags: core::ffi::c_int) -> core::ffi::c_int;
|
||||
}
|
||||
|
||||
impl Tree {
|
||||
/// Get the root node of the syntax tree.
|
||||
#[doc(alias = "ts_tree_root_node")]
|
||||
|
|
@ -1550,7 +1555,8 @@ impl Tree {
|
|||
#[cfg(windows)]
|
||||
{
|
||||
let handle = file.as_raw_handle();
|
||||
unsafe { ffi::ts_tree_print_dot_graph(self.0.as_ptr(), handle as i32) }
|
||||
let fd = unsafe { _open_osfhandle(handle as isize, 0) };
|
||||
unsafe { ffi::ts_tree_print_dot_graph(self.0.as_ptr(), fd) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue