Skip to content
This repository was archived by the owner on Aug 15, 2023. It is now read-only.

Commit dd8dcd4

Browse files
author
Stefano Kowalke
committed
Return valid exit codes
Resolves: #19
1 parent 54d9232 commit dd8dcd4

File tree

5 files changed

+15
-13
lines changed

5 files changed

+15
-13
lines changed

Classes/Command/BackendApiCommandController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ public function unlockCommand() {
5959
unlink(PATH_typo3conf . 'LOCK_BACKEND');
6060
if (@is_file((PATH_typo3conf . 'LOCK_BACKEND'))) {
6161
$this->outputLine('ERROR: Could not remove lock file \'typo3conf/LOCK_BACKEND\'!');
62-
$this->sendAndExit(1);
62+
$this->quit(1);
6363
} else {
6464
$this->outputLine('Removed lock file \'typo3conf/LOCK_BACKEND\'');
6565
}
6666
} else {
6767
$this->outputLine('No lock file \'typo3conf/LOCK_BACKEND\' was found, hence no lock could be removed.');
68-
$this->sendAndExit(2);
68+
$this->quit(1);
6969
}
7070
}
7171
}

Classes/Command/CacheApiCommandController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,4 @@ public function clearAllExceptPageCacheCommand() {
117117
$clearedCaches = $this->cacheApiService->clearAllExceptPageCache();
118118
$this->outputLine('Cleared caches: ' . implode(', ', $clearedCaches));
119119
}
120-
}
120+
}

Classes/Command/DatabaseApiCommandController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function databaseCompareCommand($actions = '', $dry = FALSE) {
7070
$this->outputLine('DB has been compared');
7171
} else {
7272
$this->outputLine('DB could not be compared, Error(s): %s', array(LF . implode(LF, $result)));
73-
$this->quit();
73+
$this->quit(1);
7474
}
7575
}
7676
}

Classes/Command/ExtensionApiCommandController.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function infoCommand($key) {
6363
$data = $this->extensionApiService->getExtensionInformation($key);
6464
} catch (Exception $e) {
6565
$this->outputLine($e->getMessage());
66-
$this->quit();
66+
$this->quit(1);
6767
}
6868

6969
$this->outputLine('');
@@ -121,7 +121,7 @@ public function listInstalledCommand($type = '') {
121121
$type = ucfirst(strtolower($type));
122122
if (!empty($type) && $type !== 'Local' && $type !== 'Global' && $type !== 'System') {
123123
$this->outputLine('Only "Local", "System" and "Global" are supported as type (or nothing)');
124-
$this->quit();
124+
$this->quit(1);
125125
}
126126

127127
$extensions = $this->extensionApiService->listExtensions($type);
@@ -166,7 +166,7 @@ public function installCommand($key) {
166166
$this->extensionApiService->installExtension($key);
167167
} catch (Exception $e) {
168168
$this->outputLine($e->getMessage());
169-
$this->quit();
169+
$this->quit(1);
170170
}
171171
$this->outputLine(sprintf('Extension "%s" is now installed!', $key));
172172
}
@@ -183,7 +183,7 @@ public function uninstallCommand($key) {
183183
$this->extensionApiService->uninstallExtension($key);
184184
} catch (Exception $e) {
185185
$this->outputLine($e->getMessage());
186-
$this->quit();
186+
$this->quit(1);
187187
}
188188
$this->outputLine(sprintf('Extension "%s" is now uninstalled!', $key));
189189
}
@@ -230,14 +230,15 @@ public function configureCommand($key, $configFile = '', $settings = '') {
230230
}
231231

232232
if (empty($conf)) {
233+
$this->response->setExitCode(1);
233234
throw new InvalidArgumentException(sprintf('No configuration settings!', $key));
234235
}
235236

236237
$this->extensionApiService->configureExtension($key, $conf);
237238

238239
} catch (Exception $e) {
239240
$this->outputLine($e->getMessage());
240-
$this->quit();
241+
$this->quit(1);
241242
}
242243
$this->outputLine(sprintf('Extension "%s" has been configured!', $key));
243244
}
@@ -259,7 +260,7 @@ public function fetchCommand($key, $version = '', $location = 'Local', $overwrit
259260
$this->outputLine(sprintf('Extension "%s" version %s has been fetched from repository! Dependencies were not resolved.', $data['main']['extKey'], $data['main']['version']));
260261
} catch (Exception $e) {
261262
$this->outputLine($e->getMessage());
262-
$this->quit();
263+
$this->quit(1);
263264
}
264265
}
265266

@@ -278,7 +279,7 @@ public function listMirrorsCommand() {
278279
}
279280
} catch (Exception $e) {
280281
$this->outputLine($e->getMessage());
281-
$this->quit();
282+
$this->quit(1);
282283
}
283284
}
284285

@@ -297,7 +298,7 @@ public function importCommand($file, $location = 'Local', $overwrite = FALSE) {
297298
$this->outputLine(sprintf('Extension "%s" has been imported!', $data['extKey']));
298299
} catch (Exception $e) {
299300
$this->outputLine($e->getMessage());
300-
$this->quit();
301+
$this->quit(1);
301302
}
302303
}
303304

Classes/Command/SiteApiCommandController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,14 @@ public function createSysNewsCommand($header, $text = '') {
8181
$result = $this->siteApiService->createSysNews($header, $text);
8282
} catch (\Exception $e) {
8383
$this->outputLine($e->getMessage());
84-
$this->quit();
84+
$this->quit(1);
8585
}
8686

8787
if ($result) {
8888
$this->outputLine('News entry successfully created.');
8989
} else {
9090
$this->outputLine('News entry NOT created.');
91+
$this->quit(1);
9192
}
9293
}
9394
}

0 commit comments

Comments
 (0)