Skip to content

fix(new): do not hand the Composer flags to rm and rd, so --force works on Linux - #13

Merged
ogorzalka merged 1 commit into
mainfrom
fix/force-rm
Nov 13, 2026
Merged

ogorzalka merged 1 commit into
mainfrom
fix/force-rm

Conversation

@ogorzalka

Copy link
Copy Markdown
Member

pollora new <name> --force failed on Linux (and in WSL) when the directory already existed, with rm: unrecognized option '--no-ansi' and the message "There was a problem installing Pollora!".

RunsCommands::runCommands() adds --no-ansi (when the output is not decorated) and --quiet (with -q) to every command, because they are Composer flags. It already leaves chmod, git and ddev alone, but not the rm -rf "<dir>" (or rd /s /q "<dir>" on Windows) that --force runs before composer create-project. The rm of macOS reads the flag as one more file name, which -f ignores, so it worked there; GNU rm takes options anywhere in the line and refuses the one it does not know.

rm and rd now join chmod, git and ddev in the commands that do not get the flags.

Tests

RunsCommandsFlagsTest reads back the command line that runCommands() builds: no flag on rm or rd (with or without --quiet), --no-ansi and --quiet still on the other commands, chmod, git and ddev still without. Without the change the two rm / rd tests fail (on macOS too, since the command line is checked, not the effect); with it the file passes, also in a php:8.4-cli (Linux) container. The 61 tests pass; Pint, PHPStan, Rector (--dry-run) and tests/Arch.php are clean.

Found while adding coverage tests for the package (a test of --force, which passed on macOS and failed on Linux in the CI).

@ogorzalka
ogorzalka merged commit d5ddda7 into main Nov 13, 2026
12 checks passed
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.

1 participant