diff mbox

Update sar command and handle OSError error.

Message ID 1269926664-7199-1-git-send-email-fyang@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Feng Yang March 30, 2010, 5:24 a.m. UTC
None
diff mbox

Patch

diff --git a/client/profilers/sar/sar.py b/client/profilers/sar/sar.py
index fbe0639..e10156f 100644
--- a/client/profilers/sar/sar.py
+++ b/client/profilers/sar/sar.py
@@ -21,14 +21,17 @@  class sar(profiler.profiler):
         logfile = open(os.path.join(test.profdir, "sar"), 'w')
         # Save the sar data as binary, convert to text after the test.
         raw = os.path.join(test.profdir, "sar.raw")
-        cmd = "/usr/bin/sar -o %s %d 0" % (raw, self.interval)
+        cmd = "/usr/bin/sar -o %s %d " % (raw, self.interval)
         p = subprocess.Popen(cmd, shell=True, stdout=logfile, \
                              stderr=subprocess.STDOUT)
         self.pid = p.pid
 
 
     def stop(self, test):
-        os.kill(self.pid, 15)
+        try:
+            os.kill(self.pid, 15)
+        except OSError:
+            pass
 
 
     def report(self, test):