fix: stop a stray console window opening on windows (#770)
This commit is contained in:
parent
0251456b11
commit
b2c2289853
5 changed files with 21 additions and 4 deletions
|
|
@ -7,6 +7,7 @@ pub mod domain;
|
|||
pub mod os_ext;
|
||||
pub mod paths;
|
||||
pub mod patch;
|
||||
pub mod process;
|
||||
pub mod search;
|
||||
pub mod version;
|
||||
|
||||
|
|
|
|||
12
packages/oneclient_common/src/process.rs
Normal file
12
packages/oneclient_common/src/process.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
pub fn no_window(command: &mut std::process::Command) {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use std::os::windows::process::CommandExt;
|
||||
|
||||
const CREATE_NO_WINDOW: u32 = 0x0800_0000;
|
||||
command.creation_flags(CREATE_NO_WINDOW);
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
let _ = command;
|
||||
}
|
||||
|
|
@ -333,7 +333,8 @@ async fn run_forge_processors(
|
|||
.await?
|
||||
.ok_or_else(|| GameError::ProcessorMainClass(processor.jar.clone()))?;
|
||||
|
||||
let output = Command::new(&java.absolute_path)
|
||||
let mut command = Command::new(&java.absolute_path);
|
||||
command
|
||||
.arg("-cp")
|
||||
.arg(game::get_classpath_library(&libraries, &cp)?)
|
||||
.arg(&main)
|
||||
|
|
@ -341,9 +342,10 @@ async fn run_forge_processors(
|
|||
&libraries,
|
||||
&processor.args,
|
||||
data,
|
||||
)?)
|
||||
.output()
|
||||
.await?;
|
||||
)?);
|
||||
oneclient_common::process::no_window(command.as_std_mut());
|
||||
|
||||
let output = command.output().await?;
|
||||
|
||||
if !output.status.success() {
|
||||
return Err(GameError::ProcessorFailed(
|
||||
|
|
|
|||
|
|
@ -655,6 +655,7 @@ async fn run_hook(hook: Option<&str>, cwd: &Path) {
|
|||
};
|
||||
|
||||
command.current_dir(cwd);
|
||||
oneclient_common::process::no_window(command.as_std_mut());
|
||||
if let Err(err) = command.status().await {
|
||||
tracing::warn!("hook '{hook}' failed: {err}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ pub async fn check_java_runtime(absolute_path: String) -> JavaResult<JavaCheckIn
|
|||
.env_remove("_JAVA_OPTIONS")
|
||||
.env_remove("JAVA_TOOL_OPTIONS")
|
||||
.env_remove("JDK_JAVA_OPTIONS");
|
||||
oneclient_common::process::no_window(command.as_std_mut());
|
||||
|
||||
let program = command.as_std().get_program().to_string_lossy();
|
||||
let args: Vec<String> = command
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue