Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

composer require --dry-run creates composer.json if not exist #11747

Closed
takaram opened this issue Dec 6, 2023 · 2 comments
Closed

composer require --dry-run creates composer.json if not exist #11747

takaram opened this issue Dec 6, 2023 · 2 comments
Labels
Milestone

Comments

@takaram
Copy link

takaram commented Dec 6, 2023

My composer.json: does not exist

When I run composer require --dry-run psr/log (or any other packages), the command runs successfully, but it creates composer.json.

$ ls -a
.  ..
$ composer --version
Composer version 2.6.5 2023-10-06 10:11:52
$ composer require --dry-run psr/log
./composer.json has been created
Running composer update psr/log
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking psr/log (3.0.0)
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing psr/log (3.0.0)
No installed packages - skipping audit.
Using version ^3.0 for psr/log
$ ls -a
.  ..  composer.json
$ cat composer.json
{
}

I expect dry-run not to create/modify any files.

@takaram
Copy link
Author

takaram commented Dec 6, 2023

This line creates the file. It does not respect dry-run flag.

@Seldaek Seldaek added this to the 2.7 milestone Dec 19, 2023
@Seldaek Seldaek added the Bug label Dec 19, 2023
@Seldaek
Copy link
Member

Seldaek commented Dec 19, 2023

Right, the file is needed at runtime even in dry run mode we cannot really do without it, but it will now be deleted after the run is complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
@Seldaek @takaram and others