Repository navigation
Support common Unix resource limits in uv run
#553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
25a5120
2b874d5
cbcd71e
247dcd0
ec68a6a
df5f11a
16473e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1403,14 +1403,38 @@ impl EnvVars { | |
| #[attr_added_in("0.5.19")] | ||
| pub const UV_GIT_LFS: &'static str = "UV_GIT_LFS"; | ||
|
|
||
| /// Sets the soft virtual-address-space limit, in bytes, for commands executed by `uv run`. | ||
| /// | ||
| /// Only supported on Unix platforms that provide `RLIMIT_AS`. | ||
| #[attr_added_in("next release")] | ||
| pub const UV_RUN_RLIMIT_AS: &'static str = "UV_RUN_RLIMIT_AS"; | ||
|
|
||
| /// Sets the soft core-file size limit, in bytes, for commands executed by `uv run`. | ||
| #[attr_added_in("next release")] | ||
| pub const UV_RUN_RLIMIT_CORE: &'static str = "UV_RUN_RLIMIT_CORE"; | ||
|
|
||
| /// Sets the soft CPU-time limit, in seconds, for commands executed by `uv run`. | ||
| #[attr_added_in("next release")] | ||
| pub const UV_RUN_RLIMIT_CPU: &'static str = "UV_RUN_RLIMIT_CPU"; | ||
|
Comment on lines
+1418
to
+1422
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P3] Document the Unix restriction for all new limits The descriptions for |
||
|
|
||
| /// Sets the soft file-size limit, in bytes, for commands executed by `uv run`. | ||
| #[attr_added_in("next release")] | ||
| pub const UV_RUN_RLIMIT_FSIZE: &'static str = "UV_RUN_RLIMIT_FSIZE"; | ||
|
|
||
| /// Sets the soft open-file descriptor limit for commands executed by `uv run`. | ||
| /// | ||
| /// The limit is applied after uv prepares the environment and immediately before the command | ||
| /// is spawned. The hard open-file descriptor limit remains unchanged. If the limit cannot be | ||
| /// The limit is applied in the child process after uv prepares the environment, before the | ||
| /// command is executed. The hard open-file descriptor limit remains unchanged. If the limit cannot be | ||
| /// applied, uv exits with an error without running the command. Only supported on Unix. | ||
| #[attr_added_in("0.12.3")] | ||
| pub const UV_RUN_RLIMIT_NOFILE: &'static str = "UV_RUN_RLIMIT_NOFILE"; | ||
|
|
||
| /// Sets the soft process-count limit for commands executed by `uv run`. | ||
| /// | ||
| /// Only supported on Unix platforms that provide `RLIMIT_NPROC`. | ||
| #[attr_added_in("next release")] | ||
| pub const UV_RUN_RLIMIT_NPROC: &'static str = "UV_RUN_RLIMIT_NPROC"; | ||
|
|
||
| /// Number of times that `uv run` has been recursively invoked. Used to guard against infinite | ||
| /// recursion, e.g., when `uv run` is used in a script shebang. | ||
| #[attr_hidden] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P3] Retain configured limits in spawn-error diagnostics
prepare()checks representability and the inherited hard limit, butsetrlimitcan still fail—for example, macOS rejectsRLIMIT_NOFILEabovekern.maxfilesperproceven with an unlimited hard limit. Returning only errno here routes that failure through the genericFailed to spawncontext, losing the environment variable and requested value that the previous implementation reported. Retain the configured names and values in the parent and include them in spawn-error context, while keeping the callback allocation-free.