mirror of
https://github.com/Swatinem/rust-cache.git
synced 2026-10-26 17:47:41 +08:00
Merge branch 'master' of https://github.com/Swatinem/rust-cache
This commit is contained in:
+6
-7
@@ -380,19 +380,18 @@ function digest(hasher: crypto.Hash): string {
|
||||
|
||||
export async function getCargoBins(): Promise<Set<string>> {
|
||||
const bins = new Set<string>();
|
||||
|
||||
try {
|
||||
const { installs }: { installs: { [key: string]: { bins: Array<string> } } } = JSON.parse(
|
||||
await fs.readFile(path.join(CARGO_HOME, ".crates2.json"), "utf8"),
|
||||
);
|
||||
for (const pkg of Object.values(installs)) {
|
||||
for (const bin of pkg.bins) {
|
||||
bins.add(bin);
|
||||
const dir = await fs.opendir(path.join(CARGO_HOME, "bin"));
|
||||
for await (const dirent of dir) {
|
||||
if (dirent.isFile()) {
|
||||
bins.add(dirent.name);
|
||||
}
|
||||
}
|
||||
} catch {}
|
||||
|
||||
return bins;
|
||||
}
|
||||
|
||||
interface RustVersion {
|
||||
host: string;
|
||||
release: string;
|
||||
|
||||
Reference in New Issue
Block a user