From ae6dbb945b8f2c2b3fc3159dcd1a453457aa63fa Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 10 Jan 2019 15:50:54 -0800 Subject: [PATCH] Avoid using unix-specific methods on windows --- cli/src/util.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/cli/src/util.rs b/cli/src/util.rs index d7d8572e..f36cbe79 100644 --- a/cli/src/util.rs +++ b/cli/src/util.rs @@ -4,8 +4,23 @@ use std::process::{Child, ChildStdin, Command, Stdio}; use std::str; use tree_sitter::Parser; +#[cfg(windows)] +pub(crate) struct LogSession(); + +#[cfg(windows)] +pub(crate) fn start_logging_graphs(parser: &mut Parser, path: &str) -> Result { + Ok(LogSession()) +} + +#[cfg(windows)] +pub(crate) fn stop_logging_graphs(parser: &mut Parser, mut session: LogSession) -> Result<()> { + Ok(()) +} + +#[cfg(unix)] pub(crate) struct LogSession(Child, ChildStdin); +#[cfg(unix)] pub(crate) fn start_logging_graphs(parser: &mut Parser, path: &str) -> Result { let mut dot_file = File::create(path)?; dot_file.write(b"\n\n\n")?; @@ -19,13 +34,20 @@ pub(crate) fn start_logging_graphs(parser: &mut Parser, path: &str) -> Result Result<()> { drop(session.1); - parser.stop_printing_dot_graphs(); + + if cfg!(unix) { + parser.stop_printing_dot_graphs(); + } + session.0.wait()?; if cfg!(target_os = "macos") {