From eb078b432fe8d77d2c8f169dd02c5d9923343e2b Mon Sep 17 00:00:00 2001 From: Ayesh Karunaratne Date: Mon, 4 Sep 2017 05:05:10 +0530 Subject: [PATCH] Prevent automatic parent directory composer.json discovery if working-dir parameter is set --- src/Composer/Console/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index bbe551a83..9f249523f 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -127,7 +127,7 @@ class Application extends BaseApplication } // prompt user for dir change if no composer.json is present in current dir - if ($io->isInteractive() && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project'), true) && !file_exists(Factory::getComposerFile())) { + if ($io->isInteractive() && !$input->getParameterOption('--working-dir') && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project'), true) && !file_exists(Factory::getComposerFile())) { $dir = dirname(getcwd()); $home = realpath(getenv('HOME') ?: getenv('USERPROFILE') ?: '/');