Proper exit code. Issue #52

This commit is contained in:
Andrés Montañez
2014-08-06 21:43:29 -03:00
parent 8df5534470
commit 5d728a9105
14 changed files with 72 additions and 18 deletions
+10 -2
View File
@@ -108,18 +108,20 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
*/
public function run()
{
$exitCode = 1000;
// Check if Environment is not Locked
$lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock';
if (file_exists($lockFile)) {
Console::output('<red>This environment is locked!</red>', 1, 2);
echo file_get_contents($lockFile);
return;
return 1010;
}
// Check for running instance and Lock
if (file_exists(getcwd() . '/.mage/~working.lock')) {
Console::output('<red>There is already an instance of Magallanes running!</red>', 1, 2);
return;
return 1020;
} else {
touch(getcwd() . '/.mage/~working.lock');
}
@@ -193,6 +195,12 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
if (file_exists(getcwd() . '/.mage/~working.lock')) {
unlink(getcwd() . '/.mage/~working.lock');
}
if (self::$failedTasks === 0) {
$exitCode = 0;
}
return $exitCode;
}
/**