Index: trunk/ippScripts/scripts/detrend_reject_exp.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_reject_exp.pl	(revision 10537)
+++ trunk/ippScripts/scripts/detrend_reject_exp.pl	(revision 10700)
@@ -215,5 +215,10 @@
 }
 
-END { system("sync") == 0 or die "failed to execute sync: $!" }
+END {
+    my $status = $?;
+    system("sync") == 0
+        or die "failed to execute sync: $!" ;
+    $? = $status;
+}
 
 # Retrieve the requested rejection limit, dying if not extant
