From 67a016878ee2c576573a55b03b44a6fc3f3ba003 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 23 Jul 2014 12:20:18 +0200 Subject: [PATCH] Switch working dir before loading composer, fixes #3146 --- src/Composer/Console/Application.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index 29615af47..e967b0418 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -104,6 +104,12 @@ class Application extends BaseApplication $input->setInteractive(false); } + // switch working dir + if ($newWorkDir = $this->getNewWorkingDir($input)) { + $oldWorkingDir = getcwd(); + chdir($newWorkDir); + } + // add non-standard scripts as own commands if ($composer = $this->getComposer(false)) { foreach ($composer->getPackage()->getScripts() as $script => $dummy) { @@ -118,11 +124,6 @@ class Application extends BaseApplication $this->io->enableDebugging($startTime); } - if ($newWorkDir = $this->getNewWorkingDir($input)) { - $oldWorkingDir = getcwd(); - chdir($newWorkDir); - } - $result = parent::doRun($input, $output); if (isset($oldWorkingDir)) {