Skip to content

Conversation

DownD
Copy link
Contributor

@DownD DownD commented May 13, 2025

When running rust-script with --clear-cache and the projects cache directory doesn't exist, an error will be thrown without running the underlaying script.

RUST_LOG=info rust-script --clear-cache scripts/generate_docs_api_spec.rs
[2025-05-13T13:25:25Z INFO  rust_script] Arguments: Args { script: Some("scripts/generate_docs_api_spec.rs"), script_args: [], expr: false, loop_: false, count: false, base_path: None, pkg_path: None, gen_pkg_only: false, cargo_output: false, clear_cache: true, debug: false, dep: [], extern_: [], force: false, unstable_features: [], build_kind: Normal, toolchain_version: None, wrapper: None }
[2025-05-13T13:25:25Z INFO  rust_script] cleaning cache with max_age: 0
[2025-05-13T13:25:25Z INFO  rust_script] max_age is 0, clearing binary cache...
[2025-05-13T13:25:25Z INFO  rust_script] cutoff:            1747142725179 ms
error: No such file or directory (os error 2)

The issue can be replicated by running the following:

rm -r /home/$USER/.cache/rust-script/projects
rust-script --clear-cache scripts/<some_script.rs>

This means that it will also happen if --clear-cache is used in the first execution after installation.

I believe the natural behavior should be to ignore the error and proceed with the script execution (thus creating the cache folder).

@fornwall fornwall merged commit cb80bb0 into fornwall:main Aug 16, 2025
@fornwall
Copy link
Owner

Thanks - this is included in the just released 0.36.0 version!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants