Skip to content

Commit

Permalink
fix: prevent terminal window from popping up on windows platform #163
Browse files Browse the repository at this point in the history
Signed-off-by: The1111mp <[email protected]>
  • Loading branch information
1111mp committed Feb 11, 2025
1 parent de5c0c4 commit 7dc5b13
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 17 deletions.
96 changes: 80 additions & 16 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"
version-compare = "0.2"

[target.'cfg(windows)'.dependencies]
windows = { version = "0.59", features = ["Win32_System_Threading"] }

[target.'cfg(target_os = "linux")'.dependencies]
openssl = { version = "0.10", features = ["vendored"] }

Expand Down
12 changes: 11 additions & 1 deletion src-tauri/src/cmds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,17 @@ pub async fn configration_import(
#[tauri::command]
pub async fn open_with_vscode(path: String) -> CmdResult<()> {
let cmd = { Config::settings().latest().coder.clone() }.unwrap();
wrap_err!(Command::new(cmd).arg(&path).status())?;
let mut command = Command::new(cmd);
command.arg(&path);

#[cfg(target_os = "windows")]
{
use std::os::windows::process::CommandExt;
use windows::Win32::System::Threading::CREATE_NO_WINDOW;
command.creation_flags(CREATE_NO_WINDOW.0);
}

wrap_err!(command.status())?;
Ok(())
}

Expand Down

0 comments on commit 7dc5b13

Please sign in to comment.