From ac72c23799a341d9fcc9ffb4c135f0a952f19428 Mon Sep 17 00:00:00 2001
From: Guo Xiang Tan <tgx_world@hotmail.com>
Date: Tue, 23 Dec 2014 14:29:44 +0800
Subject: [PATCH] Exit if a non zero status code is returned.

---
 script/bench.rb | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/script/bench.rb b/script/bench.rb
index 1b6eaaf0b9d..fa569991b70 100644
--- a/script/bench.rb
+++ b/script/bench.rb
@@ -42,11 +42,14 @@ end
 opts.parse!
 
 def run(command, opt = nil)
-  if opt == :quiet
-    system(command, out: "/dev/null", err: :out)
-  else
-    system(command, out: $stdout, err: :out)
-  end
+  exit_status =
+    if opt == :quiet
+      system(command, out: "/dev/null", err: :out)
+    else
+      system(command, out: $stdout, err: :out)
+    end
+
+  exit unless exit_status
 end
 
 begin
@@ -82,7 +85,7 @@ sudo apt-get install redis-server
 end
 
 puts "Running bundle"
-if !run("bundle", :quiet)
+if run("bundle", :quiet)
   puts "Quitting, some of the gems did not install"
   prereqs
   exit