Index: trunk/pstamp/scripts/ppstamp_run.pl
===================================================================
--- trunk/pstamp/scripts/ppstamp_run.pl	(revision 16280)
+++ trunk/pstamp/scripts/ppstamp_run.pl	(revision 16283)
@@ -96,19 +96,25 @@
 }
 
+my $jobStatus;
 {
     my $command = "$ppstamp -file $uri $outputBase $argString";
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
         run(command => $command, verbose => $verbosity);
-###
-### update the status of the job with the error
-###
-    unless ($success) {
-        die("Unable to perform $command: $error_code");
+
+    if ($success) {
+        $jobStatus = "ok";
+    } else {
+        $jobStatus = $error_code;
+        print STDERR "ppstamp failed with error code $error_code\n";
     }
+#    unless ($success) {
+#        die("Unable to perform $command: $error_code");
+#    }
 }
 
 
+# stop the job and set the error status
 {
-    my $command = "$pstamptool -processedjob -job_id $job_id -state stop -status ok";
+    my $command = "$pstamptool -processedjob -job_id $job_id -state stop -status $jobStatus";
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
         run(command => $command, verbose => $verbosity);
@@ -119,3 +125,3 @@
 
 
-exit 0;
+exit $jobStatus;
