diff --git a/Geant4/G4examples/extended/hadronic/G4Hadr00/scripts/run_hadronic_tests.py b/Geant4/G4examples/extended/hadronic/G4Hadr00/scripts/run_hadronic_tests.py
index 42e8d264d93851e977e0b6615158141069ad77c9..0d5a8463c16d5931b91da9d40bd7e95cae67e09d 100755
--- a/Geant4/G4examples/extended/hadronic/G4Hadr00/scripts/run_hadronic_tests.py
+++ b/Geant4/G4examples/extended/hadronic/G4Hadr00/scripts/run_hadronic_tests.py
@@ -55,7 +55,7 @@ template = '''#================================================
 #/gun/particle proton
 #/gun/energy 20. GeV
 #
-/run/beamOn 0
+/run/beamOn 1
 #
 '''
 
@@ -74,21 +74,25 @@ def process(particle, target, phys_list):
     with NamedTemporaryFile() as tmp:
         tmp.write(template.format(particle=particle, target=target))
         tmp.flush()
-        
+
+        job = Popen(['hadr00.exe', tmp.name, phys_list], stdout=PIPE, stderr=PIPE)
+        job_out, job_err = job.communicate()
+
+        if job.returncode:
+            sys.exit('ERROR: hadr00.exe exited with an error code!')
+
         if not os.path.exists("tables"):
             os.makedirs("tables")
         tables = open(os.path.join('tables', '{0}_{1}_{2}.txt'.format(phys_list, particle, target)),"w")
         tables.write("Energy Elastic Inelastic Total\n")
 
-        job = Popen(['hadr00.exe', tmp.name, phys_list], stdout=PIPE)
-        
         regex = re.compile(r'^\s*\d+\s+([0-9.]+)\s+([0-9.]+)\s+([0-9.]+)\s+([0-9.]+)')
         found = False
         energy = array('d')
         elastic = array('d')
         inelastic = array('d')
         total = array('d')
-        for line in job.stdout:
+        for line in job_out.split(os.linesep):
             if found:
                 m = regex.match(line)
                 if m:
@@ -156,12 +160,12 @@ for p,ap in zip(part,apart) :
     if "kaon" in p :
         gr0.SetMaximum(1.5)
     gr0.Draw("AL")
-  
+
     gr1.SetLineWidth(2)
     gr1.SetLineColor(1)
     gr1.SetLineStyle(2)
     gr1.Draw("samesL")
-  
+
     gr2.SetLineWidth(2);
     gr2.SetLineStyle(1)
     gr2.SetLineColor(4);
@@ -184,5 +188,3 @@ for p,ap in zip(part,apart) :
     c1.SetGridx();
     c1.Print("phys_list_comparison_"+p.replace("-","")+".pdf")
     c1.Print("phys_list_comparison_"+p.replace("-","")+".C")
-
-