[Po4a-commits] "po4a po4a,1.43,1.44"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Sat Nov 19 21:27:52 UTC 2005


Update of /cvsroot/po4a/po4a
In directory haydn:/tmp/cvs-serv19379

Modified Files:
	po4a 
Log Message:
Fixes the error messages when msgmerge fails.


Index: po4a
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- po4a	19 Nov 2005 18:27:53 -0000	1.43
+++ po4a	19 Nov 2005 21:27:50 -0000	1.44
@@ -642,8 +642,34 @@
 
 		$pot->write($pot_filename);
 		$po->write($po_filename);
-		system ("msgmerge -U $po_filename $pot_filename --backup=none")
-		    && die wrap_msg(gettext("Error while running msgmerge: %s"), $!);
+
+		my $cmd;
+		$cmd = "msgmerge -U $po_filename $pot_filename --backup=none";
+		my $out = qx/$cmd 2>&1/;
+		print $out if ($po4a_opts{"verbose"});
+		unless ($? == 0) {
+		    my $err = "";
+		    if ($? == -1) {
+			$err = sprintf(gettext("failed to execute '%s': %s."),
+			               $cmd, $!);
+		    } elsif ($? & 127) {
+			if ($? & 128) {
+			    $err = sprintf(gettext("'%s' died with signal %d, ".
+			                           "with coredump."),
+			                   $cmd, $? & 127);
+			} else {
+			    $err = sprintf(gettext("'%s' died with signal %d, ".
+			                           "without coredump."),
+			                   $cmd, $? & 127);
+			}
+		    } else {
+			$err = sprintf(gettext("'%s' exited with value %d."),
+			               $cmd, $? >> 8);
+		    }
+
+		    die wrap_msg(gettext("Error while running msgmerge: %s"),
+		                 $err);
+		}
 		$pores->read($po_filename);
 	    }
 	    $pores->write($po_filename{$lang}.".new");
@@ -651,15 +677,38 @@
 	    unlink($po_filename) if -e $po_filename;
 
 	} else {
-	    system ("msgmerge -U ".$po_filename{$lang}." $pot_filename".
-	            ($po4a_opts{"no-backups"}?" --backup=none":"").
-	            ($po4a_opts{"verbose"}?"":" >/dev/null 2>/dev/null"))
-		&& die wrap_msg(gettext("Error while running msgmerge: %s"), $!);
-	    system "msgfmt --statistics -v -o /dev/null ".$po_filename{$lang} 
-	    if $po4a_opts{"verbose"};
+	    my $cmd = "msgmerge -U ".$po_filename{$lang}." $pot_filename".
+	              ($po4a_opts{"no-backups"}?" --backup=none":"");
+	    my $out = qx/$cmd 2>&1/;
+	    print $out if ($po4a_opts{"verbose"});
+	    unless ($? == 0) {
+		my $err = "";
+		if ($? == -1) {
+		    $err = sprintf(gettext("failed to execute '%s': %s."),
+		                   $cmd, $!);
+		} elsif ($? & 127) {
+		    if ($? & 128) {
+			$err = sprintf(gettext("'%s' died with signal %d, ".
+		                               "with coredump."),
+			               $cmd, $? & 127);
+		    } else {
+			$err = sprintf(gettext("'%s' died with signal %d, ".
+			                       "without coredump."),
+			               $cmd, $? & 127);
+		    }
+		} else {
+		    $err = sprintf(gettext("'%s' exited with value %d."),
+		                   $cmd, $? >> 8);
+		}
+
+		die wrap_msg(gettext("Error while running msgmerge: %s"),
+		             $err);
+	    }
+	    system "msgfmt --statistics -v -o /dev/null ".$po_filename{$lang}
+		if $po4a_opts{"verbose"};
 	}
     } else {
-	print wrap_msg(gettext("Creating %s:"), $po_filename{$lang}) 
+	print wrap_msg(gettext("Creating %s:"), $po_filename{$lang})
 	    if $po4a_opts{"verbose"};
 	system ("cp",$pot_filename,$po_filename{$lang}) == 0 ||
 	    die wrap_msg(gettext("Error while copying the po file: %s"), $!);
@@ -754,5 +803,5 @@
     }
 }
 
-  
+
 __END__




More information about the Po4a-commits mailing list