Start git without a console window on Windows, and run one reload at a time
This commit was merged in pull request #3.
This commit is contained in:
+11
-6
@@ -32,12 +32,17 @@ pub struct RepoData {
|
||||
}
|
||||
|
||||
pub fn git(dir: &Path, args: &[&str]) -> Result<String, String> {
|
||||
let out = Command::new("git")
|
||||
.arg("-C")
|
||||
.arg(dir)
|
||||
.args(args)
|
||||
.output()
|
||||
.map_err(|e| format!("could not run git: {e}"))?;
|
||||
let mut cmd = Command::new("git");
|
||||
cmd.arg("-C").arg(dir).args(args);
|
||||
// gites has no console, so Windows would open a console window for every git it
|
||||
// starts. Each one flashes on screen and takes the focus, and gites reloads on focus.
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use std::os::windows::process::CommandExt;
|
||||
const CREATE_NO_WINDOW: u32 = 0x0800_0000;
|
||||
cmd.creation_flags(CREATE_NO_WINDOW);
|
||||
}
|
||||
let out = cmd.output().map_err(|e| format!("could not run git: {e}"))?;
|
||||
if !out.status.success() {
|
||||
return Err(String::from_utf8_lossy(&out.stderr).trim().to_string());
|
||||
}
|
||||
|
||||
@@ -105,11 +105,18 @@ function startDrag(e: PointerEvent, axis: "x" | "y") {
|
||||
|
||||
let filtersLoadedFor: string | null = null;
|
||||
|
||||
let loading = false;
|
||||
|
||||
async function load() {
|
||||
// The window gets focus often; one reload at a time is enough.
|
||||
if (loading) return;
|
||||
loading = true;
|
||||
try {
|
||||
await applyRepo(await invoke<RepoData>("load_repo"));
|
||||
} catch (e) {
|
||||
error.value = String(e);
|
||||
} finally {
|
||||
loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user