Skip to content

Commit

Permalink
Use (and check for) proper exit codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Jan 31, 2017
1 parent f968135 commit 306004b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 4 additions & 2 deletions framework/bin/horde-git-split
Expand Up @@ -73,7 +73,8 @@ foreach (array('app' => '', 'lib' => 'framework/') as $key => $val) {
}
}
if (is_null($package_path)) {
exit("Invalid Horde component: $package\n");
fwrite(STDERR, "Invalid Horde component: $package\n");
exit(1);
}

$tmp = empty($options['output'])
Expand All @@ -90,7 +91,8 @@ print "Package: " . $package . "\n";
print "Tag prefix: " . $tag_prefix . "\n";
print "Temporary git directory: " . $tmp . "\n\n";
if (file_exists($tmp)) {
exit("$tmp already exists.\n");
fwrite(STDERR, "$tmp already exists.\n");
exit(1);
}

foreach ($branch_keep as $branch) {
Expand Down
11 changes: 8 additions & 3 deletions framework/bin/horde-git-split-all
Expand Up @@ -3,7 +3,7 @@

// Setting basics
require_once 'Horde/Autoloader/Default.php';
set_error_handler(function() { var_dump(func_get_args()); exit; });
set_error_handler(function() { var_dump(func_get_args()); exit(1); });
$base = __DIR__ . '/../..';
$keepBranches = array(
'ansel' => 'ANSEL_4_0',
Expand All @@ -22,7 +22,8 @@ $keepBranches = array(
// Load configuration
require __FILE__ . '.conf';
if (empty($git['token'])) {
exit("GitHub access not configured.");
fwrite(STDERR, "GitHub access not configured.");
exit(1);
}

// Initialize GitHub client
Expand Down Expand Up @@ -66,8 +67,12 @@ foreach (array_reverse(glob($base . '/framework/[A-Z]*')) as $package) {
. ' --output "' . $work_dir . '"'
. ' --tmpdir "' . $tmp_dir . '"'
. ' --noprefix '
. (isset($keepBranches[$package]) ? $keepBranches[$package] : '')
. (isset($keepBranches[$package]) ? $keepBranches[$package] : ''),
$result
);
if ($result) {
exit($result);
}
$target = $work_dir . '/' . $package . '/split';
$xml = $base . '/framework/' . $package . '/package.xml';
if (file_exists($xml)) {
Expand Down

0 comments on commit 306004b

Please sign in to comment.