File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,16 +11,28 @@ mod pager;
1111include ! ( "src/args.rs" ) ;
1212
1313fn main ( ) -> Result < ( ) , Error > {
14- let outdir = match env:: var_os ( "OUT_DIR" ) {
15- None => return Ok ( ( ) ) ,
16- Some ( outdir) => outdir,
17- } ;
18-
1914 #[ cfg( target_os = "windows" ) ]
2015 {
2116 static_vcruntime:: metabuild ( ) ;
2217 }
2318
19+ // `rig_app()` builds the whole clap command tree in a single function, so in
20+ // an unoptimized build its stack frame is larger than the 1 MB main thread
21+ // stack we get on Windows. Do the work on a thread with a bigger stack.
22+ std:: thread:: Builder :: new ( )
23+ . stack_size ( 32 * 1024 * 1024 )
24+ . spawn ( generate_completions)
25+ . expect ( "failed to spawn completion generator thread" )
26+ . join ( )
27+ . expect ( "completion generator thread panicked" )
28+ }
29+
30+ fn generate_completions ( ) -> Result < ( ) , Error > {
31+ let outdir = match env:: var_os ( "OUT_DIR" ) {
32+ None => return Ok ( ( ) ) ,
33+ Some ( outdir) => outdir,
34+ } ;
35+
2436 let mut app = rig_app ( ) ;
2537 let name = "rig" . to_string ( ) ;
2638
You can’t perform that action at this time.
0 commit comments