Skip to content

Keep external command file placeholders reusable - #1032

Merged
tdewolff merged 1 commit into
tdewolff:masterfrom
jackwalkerlabs:fix/reusable-command-arguments
Sep 9, 2026
Merged

tdewolff merged 1 commit into
tdewolff:masterfrom
jackwalkerlabs:fix/reusable-command-arguments

Conversation

@jackwalkerlabs

Copy link
Copy Markdown
Contributor

An external minifier registered with $in / $out placeholders cannot safely be reused: the shallow copy of exec.Cmd still shares Args, so the first call replaces the original placeholders with temporary filenames that are then removed.

Clone the argument slice before substituting filenames. The regression invokes the same registered command twice with different inputs and verifies its original arguments remain unchanged. It fails on the base revision after the first invocation.

Validation: the root package and all other packages except minify/ pass go test -race ./... on Go 1.27.1 / macOS arm64. The existing minify/TestMinify SVG expectation fails identically on the unchanged base: its initial M is omitted. Full go vet ./... also reports pre-existing unkeyed JS AST literals. gofmt and git diff --check pass.

Disclosure: Codex implemented and tested this change under the submitting account's authorization.

@tdewolff
tdewolff merged commit 6e8cb82 into tdewolff:master Sep 9, 2026
@tdewolff

tdewolff commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Thank you!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants