Skip to content

Commit

Permalink
More varies windows stack size fixes
Browse files Browse the repository at this point in the history
Fix windows stack sizes for #4708

In this case, box clap arguments so that clap parsing can be done in the default 1MB stack on windows.
  • Loading branch information
konstin committed Jul 3, 2024
1 parent 820bdcb commit 4731809
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ fn extra_name_with_clap_error(arg: &str) -> Result<ExtraName> {
#[allow(clippy::struct_excessive_bools)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
pub command: Box<Commands>,

#[command(flatten)]
pub global_args: GlobalArgs,
pub global_args: Box<GlobalArgs>,

#[command(flatten)]
pub cache_args: CacheArgs,
pub cache_args: Box<CacheArgs>,

/// The path to a `uv.toml` file to use for configuration.
#[arg(global = true, long, env = "UV_CONFIG_FILE")]
Expand Down
9 changes: 5 additions & 4 deletions crates/uv/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ async fn run() -> Result<ExitStatus> {
let globals = GlobalSettings::resolve(&cli.command, &cli.global_args, filesystem.as_ref());

// Resolve the cache settings.
let cache_settings = CacheSettings::resolve(cli.cache_args, filesystem.as_ref());
let cache_settings = CacheSettings::resolve(*cli.cache_args, filesystem.as_ref());

// Configure the `tracing` crate, which controls internal logging.
#[cfg(feature = "tracing-durations-export")]
Expand Down Expand Up @@ -215,7 +215,7 @@ async fn run() -> Result<ExitStatus> {
// Configure the cache.
let cache = Cache::from_settings(cache_settings.no_cache, cache_settings.cache_dir)?;

match cli.command {
match *cli.command {
Commands::Pip(PipNamespace {
command: PipCommand::Compile(args),
}) => {
Expand Down Expand Up @@ -972,8 +972,9 @@ async fn run() -> Result<ExitStatus> {

fn main() -> ExitCode {
let result = if let Ok(stack_size) = env::var("UV_STACK_SIZE") {
// Artificially limit the stack size to test for stack overflows. Windows has a default stack size of 1MB,
// which is lower than the linux and mac default.
// Artificially limit or increase the stack size to test without stack overflows in debug
// mode. Windows has a default stack size of 1MB, which is lower than the linux and mac
// default.
// https://learn.microsoft.com/en-us/cpp/build/reference/stack-stack-allocations?view=msvc-170
let stack_size = stack_size.parse().expect("Invalid stack size");
let tokio_main = move || {
Expand Down

0 comments on commit 4731809

Please sign in to comment.