Browse Source

Use chdir() instead of calling multiple commands.

This improves compatibility with windows, and continues to work on *nix
systems.

Refs #5011
Mark Story 11 years ago
parent
commit
31cd0ff07d
2 changed files with 3 additions and 3 deletions
  1. 2 2
      src/Shell/Task/PluginTask.php
  2. 1 1
      tests/TestCase/Shell/Task/PluginTaskTest.php

+ 2 - 2
src/Shell/Task/PluginTask.php

@@ -264,8 +264,8 @@ class PluginTask extends BakeTask {
 		}
 
 		try {
-			$command = 'cd ' . escapeshellarg($path) . '; ';
-			$command .= 'php ' . escapeshellarg($composer) . ' dump-autoload';
+			chdir($path);
+			$command = 'php ' . escapeshellarg($composer) . ' dump-autoload';
 			$this->callProcess($command);
 		} catch (\RuntimeException $e) {
 			$error = $e->getMessage();

+ 1 - 1
tests/TestCase/Shell/Task/PluginTaskTest.php

@@ -200,7 +200,7 @@ class PluginTaskTest extends TestCase {
 
 		$this->Task->expects($this->at(3))
 			->method('callProcess')
-			->with('cd ' . escapeshellarg($path) . '; php ' . escapeshellarg('composer.phar') . ' dump-autoload');
+			->with('php ' . escapeshellarg('composer.phar') . ' dump-autoload');
 
 		$this->Task->main('BakeTestPlugin');