Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/oneclient_common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub mod domain;
pub mod os_ext;
pub mod paths;
pub mod patch;
pub mod process;
pub mod search;
pub mod version;

Expand Down
12 changes: 12 additions & 0 deletions packages/oneclient_common/src/process.rs
Original file line number Diff line number Diff line change
@@ -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;
}
10 changes: 6 additions & 4 deletions packages/oneclient_core/src/clusters/prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,17 +333,19 @@ 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)
.args(game::processor_arguments(
&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(
Expand Down
1 change: 1 addition & 0 deletions packages/oneclient_core/src/game/launch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}");
}
Expand Down
1 change: 1 addition & 0 deletions packages/oneclient_java/src/checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down