Author: bdonlan
Date: 2004-06-06 12:32:06 -0400 (Sun, 06 Jun 2004)
New Revision: 229

Modified:
   trunk/dev-tools/cold-backup.pl
Log:
cold-backup.pl handles some error cases better.

* dev-tools/cold-backup.pl:
    - Check for undefined input from svnlook
    - unlink output if svnadmin dump fails


Modified: trunk/dev-tools/cold-backup.pl
===================================================================
--- trunk/dev-tools/cold-backup.pl      2004-06-06 16:28:17 UTC (rev 228)
+++ trunk/dev-tools/cold-backup.pl      2004-06-06 16:32:06 UTC (rev 229)
@@ -71,6 +71,8 @@
        or die "Can't run $svnlook, $!";
 
 my $youngest = readline $pipe;
+die "Undefined output from svnlook, check for errors above."
+       unless defined $youngest;
 chomp $youngest;
 
 print "Youngest revision is $youngest\n";
@@ -96,9 +98,13 @@
 
 ### Step 3: Ask subversion to make a dump of a repository.
 
+my $ecode = system("(svnadmin dump '$repo_dir' > '$backup_file') 2>&1");
+if ($ecode) {
+       unlink $backup_file
+               or warn "Can't delete $backup_file: $!";
+       exit $?;
+}
 
-system("(svnadmin dump '$repo_dir' > '$backup_file') 2>&1") and exit $?;
-
 ### Step 3+1: If --symlink is given, symlink the latest version.
 if ($option{symlink}) {
        my $current = File::Spec->catfile($backup_dir, "$repo-current");


Reply via email to