=== bin/svk
==================================================================
--- bin/svk  (revision 12697)
+++ bin/svk  (local)
@@ -68,6 +68,7 @@
 ) || $ENV{USERNAME} || (getpwuid($<))[0];
 
 my $svkpath = $ENV{SVKROOT} || catfile($ENV{HOME}, ".svk");
+my $ret;
 {
     my $xd = SVK::XD->new ( giantlock => catfile($svkpath, 'lock'),
 			    statefile => catfile($svkpath, 'config'),
@@ -82,13 +83,14 @@
 	$xd->{svnconfig} = SVN::Core::config_get_config (undef);
     }
 
-    SVK::Command->invoke ($xd, $cmd, undef, @ARGV);
+    $ret = SVK::Command->invoke ($xd, $cmd, undef, @ARGV);
     $xd->store ();
 }
 
 1;
 
-exit;
+$ret = 1 if $ret && $ret !~ /^\d+$/;
+exit ($ret || 0);
 
 require PerlIO;
 require PerlIO::via;
=== lib/SVK/Command.pm
==================================================================
--- lib/SVK/Command.pm  (revision 12697)
+++ lib/SVK/Command.pm  (local)
@@ -190,10 +190,13 @@
 
     $ofh = select STDERR unless $output;
     unless ($error and $cmd->handle_error ($error)) {
-	print $ret if $ret;
+	print $ret if $ret && $ret !~ /^\d+$/;
 	print $@ if $@;
+	$ret = 1 if $@ && !$ret;
     }
-    select $ofh if $ofh
+    select $ofh if $ofh;
+
+    return $ret;
 }
 
 =head3 getopt ($argv, %opt)
