Skip to content

fix(cargo): skip cargo install when no crate is installed - #284

Closed
hlclarog wants to merge 1 commit into
CodelyTV:mainfrom
hlclarog:fix/cargo-update-all-empty-list
Closed

hlclarog wants to merge 1 commit into
CodelyTV:mainfrom
hlclarog:fix/cargo-update-all-empty-list

Conversation

@hlclarog

Copy link
Copy Markdown

Closes #283

Problem

dot package update_all pipes the installed crates to xargs -n1 cargo install. When cargo is installed but no crate is, xargs still runs cargo install once without arguments, so every run prints a cargo error (<dir> is not a crate root; specify a crate to install from crates.io ...) and then reports Done.

Fix

Read the crate list in a while read loop, which runs nothing for an empty list and keeps one cargo install <crate> per crate, the behaviour #113 introduced for several crates. This avoids GNU xargs -r, which BSD xargs on macOS does not reliably provide.

Testing

  • With a stubbed cargo:
    • empty list: no cargo install call (before: one call without arguments);
    • two crates: cargo install docpars and cargo install ripgrep, the same as before.
  • scripts/self/static_analysis and scripts/self/lint pass.

`update_all` pipes the installed crates to `xargs -n1 cargo install`. With no
crate installed, xargs still runs `cargo install` once without arguments, so
every `dot package update_all` prints a cargo error, for example
"<dir> is not a crate root; specify a crate to install from crates.io", and
then reports "Done".

Reading the list in a loop runs nothing for an empty list. It avoids GNU
`xargs -r`, which the BSD xargs on macOS does not reliably provide.
@hlclarog hlclarog closed this Oct 1, 2026
@hlclarog
hlclarog deleted the fix/cargo-update-all-empty-list branch October 1, 2026 00:25
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.

cargo: update_all prints an error when no crate is installed

1 participant