From d7f3c3d8bd2d53a4e58c76915e9206a5e4db7c71 Mon Sep 17 00:00:00 2001 From: Dmitry Stepanov Date: Wed, 11 Dec 2024 15:56:53 +0300 Subject: [PATCH] fixed hang in the editor if it was run from the project manager - hang happened in the Stdio::lock() because of piped output that was set for the editor process --- editor/src/lib.rs | 9 +++++++-- fyrox-build-tools/src/lib.rs | 19 ++++++------------- project-manager/src/manager.rs | 3 ++- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/editor/src/lib.rs b/editor/src/lib.rs index 8f0372d08..ef28317d0 100644 --- a/editor/src/lib.rs +++ b/editor/src/lib.rs @@ -173,6 +173,7 @@ use fyrox::gui::log::LogPanel; use fyrox_build_tools::BuildCommand; pub use message::Message; use plugins::inspector::InspectorPlugin; +use std::process::Stdio; use std::{ cell::RefCell, collections::VecDeque, @@ -1495,7 +1496,11 @@ impl Editor { let mut command = build_profile.run_command.make_command(); - command.arg("--").arg("--override-scene").arg(path); + command + .stdout(Stdio::piped()) + .arg("--") + .arg("--override-scene") + .arg(path); match command.spawn() { Ok(mut process) => { @@ -2127,7 +2132,7 @@ impl Editor { if let Some(build_command) = queue.pop_front() { Log::info(format!("Trying to run build command: {build_command}")); - match build_command.make_command().spawn() { + match build_command.make_command().stderr(Stdio::piped()).spawn() { Ok(mut new_process) => { self.build_window.listen( new_process.stderr.take().unwrap(), diff --git a/fyrox-build-tools/src/lib.rs b/fyrox-build-tools/src/lib.rs index 6cd6d983a..eec064308 100644 --- a/fyrox-build-tools/src/lib.rs +++ b/fyrox-build-tools/src/lib.rs @@ -21,10 +21,7 @@ use fyrox_core::{reflect::prelude::*, type_traits::prelude::*}; use serde::{Deserialize, Serialize}; use std::collections::VecDeque; -use std::{ - fmt::{Display, Formatter}, - process::Stdio, -}; +use std::fmt::{Display, Formatter}; #[derive(Deserialize, Serialize, PartialEq, Clone, Debug, Default, Reflect, TypeUuidProvider)] #[type_uuid(id = "55e7651e-8840-4c81-aa93-3f01348855e6")] @@ -45,15 +42,11 @@ impl BuildCommand { pub fn make_command(&self) -> std::process::Command { let mut command = std::process::Command::new(&self.command); - command - .stderr(Stdio::piped()) - .stdout(Stdio::piped()) - .args(self.args.iter()) - .envs( - self.environment_variables - .iter() - .map(|v| (&v.name, &v.value)), - ); + command.args(self.args.iter()).envs( + self.environment_variables + .iter() + .map(|v| (&v.name, &v.value)), + ); command } diff --git a/project-manager/src/manager.rs b/project-manager/src/manager.rs index 49b63dc22..508fd5132 100644 --- a/project-manager/src/manager.rs +++ b/project-manager/src/manager.rs @@ -54,6 +54,7 @@ use fyrox::{ }, }; use fyrox_build_tools::{BuildCommand, BuildProfile}; +use std::process::Stdio; use std::{ collections::VecDeque, path::{Path, PathBuf}, @@ -485,7 +486,7 @@ impl ProjectManager { let mut command = build_command.make_command(); - command.current_dir(current_dir); + command.stderr(Stdio::piped()).current_dir(current_dir); match command.spawn() { Ok(mut new_process) => {