Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ populate middleware:
| `--offset` | `offset` | `0` | Client-side starting offset for list output. |
| `--schema` | `schema` | `false` | Renders command schema instead of running business logic. |
| `--reason` | `reason` | empty | Reason passed to authorization. |
| `--timeout` | `timeout` | `60s` | Command deadline; `0s` disables it. |
| `--timeout` | `timeout` | `0s` | Command deadline (e.g. `60s`, `5m`); default `0s` = no timeout. |
| `--debug` | `debug` | empty | Enables debug behavior for integrations that use it. |
| `--search` | `search` | empty | Searches command and guide documentation before command execution. |

Expand Down
2 changes: 1 addition & 1 deletion docs/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ Framework global flags populate middleware and apply consistently to every comma
| `--offset` | Client-side starting offset for list output. |
| `--schema` | Renders command schema instead of running business logic. |
| `--reason` | Reason passed to authorization, audit, and activity. |
| `--timeout` | Command deadline; `0s` disables the deadline. |
| `--timeout` | Command deadline (e.g. `60s`, `5m`); default is no timeout (`0s`). |
| `--debug` | Debug selector for integrations that use it. |
| `--search` | Searches command and guide documentation before command execution. |
| `--version`, `-v` | Prints version/build metadata. |
Expand Down
8 changes: 4 additions & 4 deletions src/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl Default for GlobalFlags {
offset: 0,
schema: false,
reason: String::new(),
timeout: "60s".to_owned(),
timeout: "0s".to_owned(),
debug: String::new(),
search: String::new(),
}
Expand Down Expand Up @@ -150,9 +150,9 @@ pub fn register_global_flags(command: Command) -> Command {
.long("timeout")
.global(true)
.allow_hyphen_values(true)
.default_value("60s")
.default_value("0s")
.value_name("DURATION")
.help("Overall command timeout (e.g. 60s, 5m); use 0s to disable"),
.help("Overall command timeout (e.g. 60s, 5m); default 0s = no timeout"),
)
.arg(
Arg::new("debug")
Expand Down Expand Up @@ -236,7 +236,7 @@ pub fn global_flags_from_matches(matches: &ArgMatches) -> GlobalFlags {
timeout: matches
.get_one::<String>("timeout")
.cloned()
.unwrap_or_else(|| "60s".to_owned()),
.unwrap_or_else(|| "0s".to_owned()),
debug: matches
.get_one::<String>("debug")
.cloned()
Expand Down
11 changes: 9 additions & 2 deletions tests/foundation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2753,7 +2753,7 @@ async fn runtime_command_context_exposes_args_user_args_path_and_middleware() {
"user_region_present": false,
"output": "json",
"debug": "*",
"timeout_present": true,
"timeout_present": false,
"app": "my-cli",
"credential_present": false
})
Expand Down Expand Up @@ -3483,7 +3483,7 @@ fn global_flag_defaults_and_derived_flag_classes_cover_common_clap_actions() {
offset: 0,
schema: false,
reason: String::new(),
timeout: "60s".to_owned(),
timeout: "0s".to_owned(),
debug: String::new(),
search: String::new(),
}
Expand Down Expand Up @@ -8854,6 +8854,13 @@ impl AuthProvider for EmptyThenFilledProvider {
fn make_executable(path: &std::path::Path) {
use std::os::unix::fs::PermissionsExt;

// Sync the file to disk before changing permissions and executing.
// Without this, Linux can return ETXTBSY when the exec races with
// the kernel flushing the write from std::fs::write.
let file = std::fs::File::open(path).expect("script should be openable for sync");
file.sync_all().expect("script sync should succeed");
drop(file);

let mut permissions = std::fs::metadata(path)
.expect("script metadata should be readable")
.permissions();
Expand Down
Loading