Skip to content

Commit

Permalink
fixed hang in the editor if it was run from the project manager
Browse files Browse the repository at this point in the history
- hang happened in the Stdio::lock() because of piped output that was set for the editor process
  • Loading branch information
mrDIMAS committed Dec 11, 2024
1 parent 6a70cfe commit d7f3c3d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
9 changes: 7 additions & 2 deletions editor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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(),
Expand Down
19 changes: 6 additions & 13 deletions fyrox-build-tools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand All @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion project-manager/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ use fyrox::{
},
};
use fyrox_build_tools::{BuildCommand, BuildProfile};
use std::process::Stdio;
use std::{
collections::VecDeque,
path::{Path, PathBuf},
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit d7f3c3d

Please sign in to comment.