Skip to content

Commit fb35e23

Browse files
Merge pull request #865 from timeshift92/fix/windows-startup-stack-849
LGTM. Correct fix — Clap's command graph can overflow the default 1MB Windows stack. /STACK:8388608 is a standard mitigation.
2 parents b79623c + 12276c1 commit fb35e23

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

build.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ use std::fs;
33
use std::path::Path;
44

55
fn main() {
6+
#[cfg(windows)]
7+
{
8+
// Clap + the full command graph can exceed the default 1 MiB Windows
9+
// main-thread stack during process startup. Reserve a larger stack for
10+
// the CLI binary so `rtk.exe --version`, `--help`, and hook entry
11+
// points start reliably without requiring ad-hoc RUSTFLAGS.
12+
println!("cargo:rustc-link-arg=/STACK:8388608");
13+
}
14+
615
let filters_dir = Path::new("src/filters");
716
let out_dir = std::env::var("OUT_DIR").expect("OUT_DIR must be set by Cargo");
817
let dest = Path::new(&out_dir).join("builtin_filters.toml");

0 commit comments

Comments
 (0)