From c48df9db024534709c0bfc5381dda99c0ce334d9 Mon Sep 17 00:00:00 2001 From: Jacobtread Date: Sun, 3 Aug 2025 22:10:10 +1200 Subject: [PATCH 1/9] fix: windows use powershell to extract zip file For windows platforms the unzip utility is not on systems by default, this changes it so that on windows powershell is used in combination with Expand-Archive to extract the zip file --- .../templates/installer/npm/binary-install.js | 33 +++++++++++++++---- cargo-dist/templates/installer/npm/binary.js | 2 +- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/cargo-dist/templates/installer/npm/binary-install.js b/cargo-dist/templates/installer/npm/binary-install.js index 4775d7426..dd25ff104 100644 --- a/cargo-dist/templates/installer/npm/binary-install.js +++ b/cargo-dist/templates/installer/npm/binary-install.js @@ -13,7 +13,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -47,6 +47,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -122,12 +124,29 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes('windows')) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync( + "powershell.exe", + [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ] + ); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + + if (result.status == 0) { resolve(); } else if (result.error) { diff --git a/cargo-dist/templates/installer/npm/binary.js b/cargo-dist/templates/installer/npm/binary.js index 3e8f15d84..95e2a9d5c 100644 --- a/cargo-dist/templates/installer/npm/binary.js +++ b/cargo-dist/templates/installer/npm/binary.js @@ -96,7 +96,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; From b65d3edb245baea84dc1531c0c2b75ca283ea057 Mon Sep 17 00:00:00 2001 From: Jacobtread Date: Tue, 5 Aug 2025 15:53:32 +1200 Subject: [PATCH 2/9] chore: apply prettier formatting --- .../templates/installer/npm/binary-install.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/cargo-dist/templates/installer/npm/binary-install.js b/cargo-dist/templates/installer/npm/binary-install.js index dd25ff104..43d9c16d7 100644 --- a/cargo-dist/templates/installer/npm/binary-install.js +++ b/cargo-dist/templates/installer/npm/binary-install.js @@ -125,18 +125,15 @@ class Package { } } else if (this.zipExt == ".zip") { let result; - if (this.platform.includes('windows')) { + if (this.platform.includes("windows")) { // Windows does not have "unzip" by default on many installations, instead // we use Expand-Archive from powershell - result = spawnSync( - "powershell.exe", - [ - "-NoProfile", - "-NonInteractive", - "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, - ] - ); + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); } else { result = spawnSync("unzip", [ "-q", @@ -146,7 +143,6 @@ class Package { ]); } - if (result.status == 0) { resolve(); } else if (result.error) { From d96f747c328b4b5add0065d1ee8cab9e14d6309f Mon Sep 17 00:00:00 2001 From: Jacobtread Date: Tue, 5 Aug 2025 16:06:34 +1200 Subject: [PATCH 3/9] chore: update test snapshots --- .../snapshots/axolotlsay_action_commit.snap | 31 ++++++++++++++----- .../tests/snapshots/axolotlsay_alias.snap | 31 ++++++++++++++----- ...axolotlsay_alias_ignores_missing_bins.snap | 31 ++++++++++++++----- .../snapshots/axolotlsay_basic_bins.snap | 31 ++++++++++++++----- .../snapshots/axolotlsay_basic_lies.snap | 31 ++++++++++++++----- .../axolotlsay_build_setup_steps.snap | 31 ++++++++++++++----- .../axolotlsay_disable_source_tarball.snap | 31 ++++++++++++++----- .../snapshots/axolotlsay_edit_existing.snap | 31 ++++++++++++++----- .../axolotlsay_homebrew_packages.snap | 31 ++++++++++++++----- .../tests/snapshots/axolotlsay_musl.snap | 31 ++++++++++++++----- .../snapshots/axolotlsay_musl_no_gnu.snap | 31 ++++++++++++++----- .../axolotlsay_no_homebrew_publish.snap | 31 ++++++++++++++----- .../snapshots/axolotlsay_several_aliases.snap | 31 ++++++++++++++----- .../tests/snapshots/axolotlsay_updaters.snap | 31 ++++++++++++++----- .../axolotlsay_user_global_build_job.snap | 31 ++++++++++++++----- .../snapshots/axolotlsay_user_host_job.snap | 31 ++++++++++++++----- .../axolotlsay_user_local_build_job.snap | 31 ++++++++++++++----- .../snapshots/axolotlsay_user_plan_job.snap | 31 ++++++++++++++----- .../axolotlsay_user_publish_job.snap | 31 ++++++++++++++----- 19 files changed, 437 insertions(+), 152 deletions(-) diff --git a/cargo-dist/tests/snapshots/axolotlsay_action_commit.snap b/cargo-dist/tests/snapshots/axolotlsay_action_commit.snap index e04c988cf..a40478672 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_action_commit.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_action_commit.snap @@ -2521,7 +2521,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -2555,6 +2555,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -2630,12 +2632,25 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2798,7 +2813,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; diff --git a/cargo-dist/tests/snapshots/axolotlsay_alias.snap b/cargo-dist/tests/snapshots/axolotlsay_alias.snap index af8415d9e..1ca32ab01 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_alias.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_alias.snap @@ -2474,7 +2474,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -2508,6 +2508,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -2583,12 +2585,25 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2751,7 +2766,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; diff --git a/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap b/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap index 644c25746..a55a0b84c 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap @@ -2478,7 +2478,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -2512,6 +2512,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -2587,12 +2589,25 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2755,7 +2770,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; diff --git a/cargo-dist/tests/snapshots/axolotlsay_basic_bins.snap b/cargo-dist/tests/snapshots/axolotlsay_basic_bins.snap index 96af5e469..e7d685386 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_basic_bins.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_basic_bins.snap @@ -2521,7 +2521,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -2555,6 +2555,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -2630,12 +2632,25 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2798,7 +2813,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; diff --git a/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap b/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap index 5e8a48ce0..e0de7488b 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap @@ -2446,7 +2446,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -2480,6 +2480,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -2555,12 +2557,25 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2723,7 +2738,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; diff --git a/cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap b/cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap index 39ec1a31f..e15be19a8 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap @@ -2443,7 +2443,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -2477,6 +2477,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -2552,12 +2554,25 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2720,7 +2735,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; diff --git a/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap b/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap index fb24f5ebb..fd299913d 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap @@ -2443,7 +2443,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -2477,6 +2477,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -2552,12 +2554,25 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2720,7 +2735,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; diff --git a/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap b/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap index 6cc78c37d..fdee2e2ac 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap @@ -2443,7 +2443,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -2477,6 +2477,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -2552,12 +2554,25 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2720,7 +2735,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; diff --git a/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap b/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap index dfed318fd..4ee29c382 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap @@ -2443,7 +2443,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -2477,6 +2477,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -2552,12 +2554,25 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2720,7 +2735,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; diff --git a/cargo-dist/tests/snapshots/axolotlsay_musl.snap b/cargo-dist/tests/snapshots/axolotlsay_musl.snap index c60e57dab..6ea32951f 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_musl.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_musl.snap @@ -1829,7 +1829,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -1863,6 +1863,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -1938,12 +1940,25 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2106,7 +2121,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; diff --git a/cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap b/cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap index 93e7d8f36..cfd5ae361 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap @@ -1809,7 +1809,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -1843,6 +1843,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -1918,12 +1920,25 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2086,7 +2101,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; diff --git a/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap b/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap index 4e460382c..fb64e54a4 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap @@ -2443,7 +2443,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -2477,6 +2477,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -2552,12 +2554,25 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2720,7 +2735,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; diff --git a/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap b/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap index 6156d0f32..c864aee13 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap @@ -2478,7 +2478,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -2512,6 +2512,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -2587,12 +2589,25 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2755,7 +2770,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; diff --git a/cargo-dist/tests/snapshots/axolotlsay_updaters.snap b/cargo-dist/tests/snapshots/axolotlsay_updaters.snap index 47d6c611f..358792c73 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_updaters.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_updaters.snap @@ -2455,7 +2455,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -2489,6 +2489,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -2564,12 +2566,25 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2732,7 +2747,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap index 01c0ddb9e..758471973 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap @@ -2443,7 +2443,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -2477,6 +2477,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -2552,12 +2554,25 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2720,7 +2735,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap index b291a81c4..e819ebaf6 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap @@ -2443,7 +2443,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -2477,6 +2477,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -2552,12 +2554,25 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2720,7 +2735,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap index abb44857a..9d516e6c8 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap @@ -2443,7 +2443,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -2477,6 +2477,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -2552,12 +2554,25 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2720,7 +2735,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap index d05b1d26d..bbdbb4eec 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap @@ -2443,7 +2443,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -2477,6 +2477,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -2552,12 +2554,25 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2720,7 +2735,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap index a9188c229..6fd4a2790 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap @@ -2443,7 +2443,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -2477,6 +2477,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -2552,12 +2554,25 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2720,7 +2735,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; From 030b71169076a982fb7e5f9764e276e2ae3160d0 Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Mon, 4 Aug 2025 22:16:54 -0700 Subject: [PATCH 4/9] chore: finish updating snapshots --- .../tests/snapshots/axolotlsay_basic.snap | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/cargo-dist/tests/snapshots/axolotlsay_basic.snap b/cargo-dist/tests/snapshots/axolotlsay_basic.snap index 2825a3509..3c1138105 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_basic.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_basic.snap @@ -2560,7 +2560,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -2594,6 +2594,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -2669,12 +2671,25 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2837,7 +2852,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; From a4de777e58d07f99dbb4a8116ef5aaed5c4eed75 Mon Sep 17 00:00:00 2001 From: Jacobtread Date: Mon, 25 Aug 2025 12:41:13 +1200 Subject: [PATCH 5/9] fix: prevent shell injection --- cargo-dist/templates/installer/npm/binary-install.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cargo-dist/templates/installer/npm/binary-install.js b/cargo-dist/templates/installer/npm/binary-install.js index 43d9c16d7..5f4a4b1a0 100644 --- a/cargo-dist/templates/installer/npm/binary-install.js +++ b/cargo-dist/templates/installer/npm/binary-install.js @@ -132,7 +132,9 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + tempFile, + this.installDirectory ]); } else { result = spawnSync("unzip", [ From b028deaabfdb9cd293d22cd2ff4bad41f8b90f41 Mon Sep 17 00:00:00 2001 From: Jacobtread Date: Mon, 25 Aug 2025 13:08:45 +1200 Subject: [PATCH 6/9] feat: update snapshots --- cargo-dist/tests/snapshots/axolotlsay_action_commit.snap | 4 +++- cargo-dist/tests/snapshots/axolotlsay_alias.snap | 4 +++- .../snapshots/axolotlsay_alias_ignores_missing_bins.snap | 4 +++- cargo-dist/tests/snapshots/axolotlsay_basic_bins.snap | 4 +++- cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap | 4 +++- cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap | 4 +++- .../tests/snapshots/axolotlsay_disable_source_tarball.snap | 4 +++- cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap | 4 +++- cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap | 4 +++- cargo-dist/tests/snapshots/axolotlsay_musl.snap | 4 +++- cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap | 4 +++- .../tests/snapshots/axolotlsay_no_homebrew_publish.snap | 4 +++- cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap | 4 +++- cargo-dist/tests/snapshots/axolotlsay_updaters.snap | 4 +++- .../tests/snapshots/axolotlsay_user_global_build_job.snap | 4 +++- cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap | 4 +++- .../tests/snapshots/axolotlsay_user_local_build_job.snap | 4 +++- cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap | 4 +++- cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap | 4 +++- 19 files changed, 57 insertions(+), 19 deletions(-) diff --git a/cargo-dist/tests/snapshots/axolotlsay_action_commit.snap b/cargo-dist/tests/snapshots/axolotlsay_action_commit.snap index a40478672..46213a19f 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_action_commit.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_action_commit.snap @@ -2640,7 +2640,9 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + tempFile, + this.installDirectory ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_alias.snap b/cargo-dist/tests/snapshots/axolotlsay_alias.snap index 1ca32ab01..05670d22e 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_alias.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_alias.snap @@ -2593,7 +2593,9 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + tempFile, + this.installDirectory ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap b/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap index a55a0b84c..fc68c545c 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap @@ -2597,7 +2597,9 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + tempFile, + this.installDirectory ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_basic_bins.snap b/cargo-dist/tests/snapshots/axolotlsay_basic_bins.snap index e7d685386..03abff200 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_basic_bins.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_basic_bins.snap @@ -2640,7 +2640,9 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + tempFile, + this.installDirectory ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap b/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap index e0de7488b..484364ea2 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap @@ -2565,7 +2565,9 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + tempFile, + this.installDirectory ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap b/cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap index e15be19a8..0932f6833 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap @@ -2562,7 +2562,9 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + tempFile, + this.installDirectory ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap b/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap index fd299913d..a796889df 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap @@ -2562,7 +2562,9 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + tempFile, + this.installDirectory ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap b/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap index fdee2e2ac..0a2790b7b 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap @@ -2562,7 +2562,9 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + tempFile, + this.installDirectory ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap b/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap index 4ee29c382..31e63da66 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap @@ -2562,7 +2562,9 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + tempFile, + this.installDirectory ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_musl.snap b/cargo-dist/tests/snapshots/axolotlsay_musl.snap index 6ea32951f..a5cff6d6a 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_musl.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_musl.snap @@ -1948,7 +1948,9 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + tempFile, + this.installDirectory ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap b/cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap index cfd5ae361..e2a74e429 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap @@ -1928,7 +1928,9 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + tempFile, + this.installDirectory ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap b/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap index fb64e54a4..b002c3dd7 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap @@ -2562,7 +2562,9 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + tempFile, + this.installDirectory ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap b/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap index c864aee13..aef63ae5c 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap @@ -2597,7 +2597,9 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + tempFile, + this.installDirectory ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_updaters.snap b/cargo-dist/tests/snapshots/axolotlsay_updaters.snap index 358792c73..ce6e99b79 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_updaters.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_updaters.snap @@ -2574,7 +2574,9 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + tempFile, + this.installDirectory ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap index 758471973..eb761b760 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap @@ -2562,7 +2562,9 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + tempFile, + this.installDirectory ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap index e819ebaf6..10c8700dd 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap @@ -2562,7 +2562,9 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + tempFile, + this.installDirectory ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap index 9d516e6c8..68989e85c 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap @@ -2562,7 +2562,9 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + tempFile, + this.installDirectory ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap index bbdbb4eec..4dee9ddd4 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap @@ -2562,7 +2562,9 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + tempFile, + this.installDirectory ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap index 6fd4a2790..f00c65361 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap @@ -2562,7 +2562,9 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + tempFile, + this.installDirectory ]); } else { result = spawnSync("unzip", [ From bd8dcaadbe97babb26435eacaf9e9eaff4d609c2 Mon Sep 17 00:00:00 2001 From: Jacobtread Date: Tue, 26 Aug 2025 15:42:27 +1200 Subject: [PATCH 7/9] feat: use alternative param style for Extract-Archive --- cargo-dist/templates/installer/npm/binary-install.js | 5 ++++- cargo-dist/tests/snapshots/axolotlsay_action_commit.snap | 5 ++++- cargo-dist/tests/snapshots/axolotlsay_alias.snap | 5 ++++- .../snapshots/axolotlsay_alias_ignores_missing_bins.snap | 5 ++++- cargo-dist/tests/snapshots/axolotlsay_basic_bins.snap | 5 ++++- cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap | 5 ++++- cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap | 5 ++++- .../tests/snapshots/axolotlsay_disable_source_tarball.snap | 5 ++++- cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap | 5 ++++- cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap | 5 ++++- cargo-dist/tests/snapshots/axolotlsay_musl.snap | 5 ++++- cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap | 5 ++++- .../tests/snapshots/axolotlsay_no_homebrew_publish.snap | 5 ++++- cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap | 5 ++++- cargo-dist/tests/snapshots/axolotlsay_updaters.snap | 5 ++++- .../tests/snapshots/axolotlsay_user_global_build_job.snap | 5 ++++- cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap | 5 ++++- .../tests/snapshots/axolotlsay_user_local_build_job.snap | 5 ++++- cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap | 5 ++++- cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap | 5 ++++- 20 files changed, 80 insertions(+), 20 deletions(-) diff --git a/cargo-dist/templates/installer/npm/binary-install.js b/cargo-dist/templates/installer/npm/binary-install.js index 5f4a4b1a0..2b38325f1 100644 --- a/cargo-dist/templates/installer/npm/binary-install.js +++ b/cargo-dist/templates/installer/npm/binary-install.js @@ -132,7 +132,10 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, tempFile, this.installDirectory ]); diff --git a/cargo-dist/tests/snapshots/axolotlsay_action_commit.snap b/cargo-dist/tests/snapshots/axolotlsay_action_commit.snap index 46213a19f..b929d46f5 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_action_commit.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_action_commit.snap @@ -2640,7 +2640,10 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, tempFile, this.installDirectory ]); diff --git a/cargo-dist/tests/snapshots/axolotlsay_alias.snap b/cargo-dist/tests/snapshots/axolotlsay_alias.snap index 05670d22e..857580c67 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_alias.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_alias.snap @@ -2593,7 +2593,10 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, tempFile, this.installDirectory ]); diff --git a/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap b/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap index fc68c545c..bd418d28b 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap @@ -2597,7 +2597,10 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, tempFile, this.installDirectory ]); diff --git a/cargo-dist/tests/snapshots/axolotlsay_basic_bins.snap b/cargo-dist/tests/snapshots/axolotlsay_basic_bins.snap index 03abff200..64a973e60 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_basic_bins.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_basic_bins.snap @@ -2640,7 +2640,10 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, tempFile, this.installDirectory ]); diff --git a/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap b/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap index 484364ea2..267859de5 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap @@ -2565,7 +2565,10 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, tempFile, this.installDirectory ]); diff --git a/cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap b/cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap index 0932f6833..98709816b 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap @@ -2562,7 +2562,10 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, tempFile, this.installDirectory ]); diff --git a/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap b/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap index a796889df..6802226f1 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap @@ -2562,7 +2562,10 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, tempFile, this.installDirectory ]); diff --git a/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap b/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap index 0a2790b7b..c6534b882 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap @@ -2562,7 +2562,10 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, tempFile, this.installDirectory ]); diff --git a/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap b/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap index 31e63da66..339bb5d02 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap @@ -2562,7 +2562,10 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, tempFile, this.installDirectory ]); diff --git a/cargo-dist/tests/snapshots/axolotlsay_musl.snap b/cargo-dist/tests/snapshots/axolotlsay_musl.snap index a5cff6d6a..031818fa7 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_musl.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_musl.snap @@ -1948,7 +1948,10 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, tempFile, this.installDirectory ]); diff --git a/cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap b/cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap index e2a74e429..fffdfc333 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap @@ -1928,7 +1928,10 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, tempFile, this.installDirectory ]); diff --git a/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap b/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap index b002c3dd7..706843568 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap @@ -2562,7 +2562,10 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, tempFile, this.installDirectory ]); diff --git a/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap b/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap index aef63ae5c..b79caf2d6 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap @@ -2597,7 +2597,10 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, tempFile, this.installDirectory ]); diff --git a/cargo-dist/tests/snapshots/axolotlsay_updaters.snap b/cargo-dist/tests/snapshots/axolotlsay_updaters.snap index ce6e99b79..bf41c4f25 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_updaters.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_updaters.snap @@ -2574,7 +2574,10 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, tempFile, this.installDirectory ]); diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap index eb761b760..8d2e80e06 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap @@ -2562,7 +2562,10 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, tempFile, this.installDirectory ]); diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap index 10c8700dd..c422dbf03 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap @@ -2562,7 +2562,10 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, tempFile, this.installDirectory ]); diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap index 68989e85c..e417e4932 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap @@ -2562,7 +2562,10 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, tempFile, this.installDirectory ]); diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap index 4dee9ddd4..e07466b64 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap @@ -2562,7 +2562,10 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, tempFile, this.installDirectory ]); diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap index f00c65361..42d24c94c 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap @@ -2562,7 +2562,10 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - "& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, tempFile, this.installDirectory ]); From ea008f0503dba8fdeff32c6dd4fc0b708418a172 Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Tue, 26 Aug 2025 21:42:28 -0300 Subject: [PATCH 8/9] tests: prettier and regen snapshots --- cargo-dist/templates/installer/npm/binary-install.js | 2 +- cargo-dist/tests/snapshots/axolotlsay_action_commit.snap | 2 +- cargo-dist/tests/snapshots/axolotlsay_alias.snap | 2 +- .../snapshots/axolotlsay_alias_ignores_missing_bins.snap | 2 +- cargo-dist/tests/snapshots/axolotlsay_basic.snap | 7 ++++++- cargo-dist/tests/snapshots/axolotlsay_basic_bins.snap | 2 +- cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap | 2 +- .../tests/snapshots/axolotlsay_build_setup_steps.snap | 2 +- .../tests/snapshots/axolotlsay_disable_source_tarball.snap | 2 +- cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap | 2 +- .../tests/snapshots/axolotlsay_homebrew_packages.snap | 2 +- cargo-dist/tests/snapshots/axolotlsay_musl.snap | 2 +- cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap | 2 +- .../tests/snapshots/axolotlsay_no_homebrew_publish.snap | 2 +- cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap | 2 +- cargo-dist/tests/snapshots/axolotlsay_updaters.snap | 2 +- .../tests/snapshots/axolotlsay_user_global_build_job.snap | 2 +- cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap | 2 +- .../tests/snapshots/axolotlsay_user_local_build_job.snap | 2 +- cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap | 2 +- .../tests/snapshots/axolotlsay_user_publish_job.snap | 2 +- 21 files changed, 26 insertions(+), 21 deletions(-) diff --git a/cargo-dist/templates/installer/npm/binary-install.js b/cargo-dist/templates/installer/npm/binary-install.js index 2b38325f1..7dedbf7a9 100644 --- a/cargo-dist/templates/installer/npm/binary-install.js +++ b/cargo-dist/templates/installer/npm/binary-install.js @@ -137,7 +137,7 @@ class Package { Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force }`, tempFile, - this.installDirectory + this.installDirectory, ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_action_commit.snap b/cargo-dist/tests/snapshots/axolotlsay_action_commit.snap index b929d46f5..f046b1d36 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_action_commit.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_action_commit.snap @@ -2645,7 +2645,7 @@ class Package { Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force }`, tempFile, - this.installDirectory + this.installDirectory, ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_alias.snap b/cargo-dist/tests/snapshots/axolotlsay_alias.snap index 857580c67..0c264d951 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_alias.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_alias.snap @@ -2598,7 +2598,7 @@ class Package { Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force }`, tempFile, - this.installDirectory + this.installDirectory, ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap b/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap index bd418d28b..96e81ffea 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap @@ -2602,7 +2602,7 @@ class Package { Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force }`, tempFile, - this.installDirectory + this.installDirectory, ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_basic.snap b/cargo-dist/tests/snapshots/axolotlsay_basic.snap index 3c1138105..9b70923fb 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_basic.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_basic.snap @@ -2679,7 +2679,12 @@ class Package { "-NoProfile", "-NonInteractive", "-Command", - `Expand-Archive -LiteralPath '${tempFile}' -DestinationPath '${this.installDirectory}' -Force`, + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, + tempFile, + this.installDirectory, ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_basic_bins.snap b/cargo-dist/tests/snapshots/axolotlsay_basic_bins.snap index 64a973e60..b73540ed9 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_basic_bins.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_basic_bins.snap @@ -2645,7 +2645,7 @@ class Package { Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force }`, tempFile, - this.installDirectory + this.installDirectory, ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap b/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap index 267859de5..7fc08e2e3 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap @@ -2570,7 +2570,7 @@ class Package { Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force }`, tempFile, - this.installDirectory + this.installDirectory, ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap b/cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap index 98709816b..6c47180e8 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap @@ -2567,7 +2567,7 @@ class Package { Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force }`, tempFile, - this.installDirectory + this.installDirectory, ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap b/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap index 6802226f1..ec7def630 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap @@ -2567,7 +2567,7 @@ class Package { Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force }`, tempFile, - this.installDirectory + this.installDirectory, ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap b/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap index c6534b882..c3e76c9eb 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap @@ -2567,7 +2567,7 @@ class Package { Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force }`, tempFile, - this.installDirectory + this.installDirectory, ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap b/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap index 339bb5d02..18d55eeb9 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap @@ -2567,7 +2567,7 @@ class Package { Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force }`, tempFile, - this.installDirectory + this.installDirectory, ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_musl.snap b/cargo-dist/tests/snapshots/axolotlsay_musl.snap index 031818fa7..c1797d9cc 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_musl.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_musl.snap @@ -1953,7 +1953,7 @@ class Package { Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force }`, tempFile, - this.installDirectory + this.installDirectory, ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap b/cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap index fffdfc333..02b87d38c 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_musl_no_gnu.snap @@ -1933,7 +1933,7 @@ class Package { Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force }`, tempFile, - this.installDirectory + this.installDirectory, ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap b/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap index 706843568..682f8dd9e 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap @@ -2567,7 +2567,7 @@ class Package { Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force }`, tempFile, - this.installDirectory + this.installDirectory, ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap b/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap index b79caf2d6..e9380d8b7 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap @@ -2602,7 +2602,7 @@ class Package { Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force }`, tempFile, - this.installDirectory + this.installDirectory, ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_updaters.snap b/cargo-dist/tests/snapshots/axolotlsay_updaters.snap index bf41c4f25..8e817ea98 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_updaters.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_updaters.snap @@ -2579,7 +2579,7 @@ class Package { Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force }`, tempFile, - this.installDirectory + this.installDirectory, ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap index 8d2e80e06..f61b2dc3e 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap @@ -2567,7 +2567,7 @@ class Package { Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force }`, tempFile, - this.installDirectory + this.installDirectory, ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap index c422dbf03..5e7e7bfe2 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap @@ -2567,7 +2567,7 @@ class Package { Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force }`, tempFile, - this.installDirectory + this.installDirectory, ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap index e417e4932..0ba0f6e23 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap @@ -2567,7 +2567,7 @@ class Package { Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force }`, tempFile, - this.installDirectory + this.installDirectory, ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap index e07466b64..03f6c02c3 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap @@ -2567,7 +2567,7 @@ class Package { Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force }`, tempFile, - this.installDirectory + this.installDirectory, ]); } else { result = spawnSync("unzip", [ diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap index 42d24c94c..9dccaefb2 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap @@ -2567,7 +2567,7 @@ class Package { Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force }`, tempFile, - this.installDirectory + this.installDirectory, ]); } else { result = spawnSync("unzip", [ From 72fa09ffaa16f28f245585e79b26f2fc70a68138 Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Tue, 26 Aug 2025 21:56:10 -0300 Subject: [PATCH 9/9] tests: regen snapshots --- .../axolotlsay_attestations_filters.snap | 36 ++++++++++++++----- .../axolotlsay_attestations_host.snap | 36 ++++++++++++++----- 2 files changed, 56 insertions(+), 16 deletions(-) diff --git a/cargo-dist/tests/snapshots/axolotlsay_attestations_filters.snap b/cargo-dist/tests/snapshots/axolotlsay_attestations_filters.snap index f5b096f94..3e1aec5e6 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_attestations_filters.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_attestations_filters.snap @@ -2521,7 +2521,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -2555,6 +2555,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -2630,12 +2632,30 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, + tempFile, + this.installDirectory, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2798,7 +2818,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; }; diff --git a/cargo-dist/tests/snapshots/axolotlsay_attestations_host.snap b/cargo-dist/tests/snapshots/axolotlsay_attestations_host.snap index 2a086f006..0d5b81692 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_attestations_host.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_attestations_host.snap @@ -2521,7 +2521,7 @@ const error = (msg) => { }; class Package { - constructor(name, url, filename, zipExt, binaries) { + constructor(platform, name, url, filename, zipExt, binaries) { let errors = []; if (typeof url !== "string") { errors.push("url must be a string"); @@ -2555,6 +2555,8 @@ class Package { '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})'; error(errorMsg); } + + this.platform = platform; this.url = url; this.name = name; this.filename = filename; @@ -2630,12 +2632,30 @@ class Package { ); } } else if (this.zipExt == ".zip") { - const result = spawnSync("unzip", [ - "-q", - tempFile, - "-d", - this.installDirectory, - ]); + let result; + if (this.platform.includes("windows")) { + // Windows does not have "unzip" by default on many installations, instead + // we use Expand-Archive from powershell + result = spawnSync("powershell.exe", [ + "-NoProfile", + "-NonInteractive", + "-Command", + `& { + param([string]$LiteralPath, [string]$DestinationPath) + Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force + }`, + tempFile, + this.installDirectory, + ]); + } else { + result = spawnSync("unzip", [ + "-q", + tempFile, + "-d", + this.installDirectory, + ]); + } + if (result.status == 0) { resolve(); } else if (result.error) { @@ -2798,7 +2818,7 @@ const getPackage = () => { const url = `${artifactDownloadUrl}/${platform.artifactName}`; let filename = platform.artifactName; let ext = platform.zipExt; - let binary = new Package(name, url, filename, ext, platform.bins); + let binary = new Package(platform, name, url, filename, ext, platform.bins); return binary; };