gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leosim...@apache.org
Subject svn commit: r159161 - gump/branches/Gump3/pygump/python/gump/util/sysinfo.py
Date Sun, 27 Mar 2005 18:38:43 GMT
Author: leosimons
Date: Sun Mar 27 10:38:42 2005
New Revision: 159161

URL: http://svn.apache.org/viewcvs?view=rev&rev=159161
Log:
Fix a number of bugs in the sysinfo module that I just introduced, where pipes weren't properly
connected.

Modified:
    gump/branches/Gump3/pygump/python/gump/util/sysinfo.py

Modified: gump/branches/Gump3/pygump/python/gump/util/sysinfo.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/util/sysinfo.py?view=diff&r1=159160&r2=159161
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/util/sysinfo.py (original)
+++ gump/branches/Gump3/pygump/python/gump/util/sysinfo.py Sun Mar 27 10:38:42 2005
@@ -30,10 +30,10 @@
     cat = Popen(["cat", "/proc/meminfo"], stdout=PIPE)
     if cat.wait():
         return amount
-    grep = Popen(["grep", "MemTotal"], stdin=cat.stdout)
+    grep = Popen(["grep", "MemTotal"], stdin=cat.stdout, stdout=PIPE)
     if grep.wait():
         return amount
-    sed = Popen(["sed", "-e", "s/[^0-9]//g"], stdin=grep.stdout)
+    sed = Popen(["sed", "-e", "s/[^0-9]//g"], stdin=grep.stdout, stdout=PIPE)
     result = sed.wait()
     if not result:
         amount = int(sed.communicate()[0])
@@ -46,16 +46,16 @@
     cat = Popen(["cat", "/proc/cpuinfo"], stdout=PIPE)
     if cat.wait():
         return amount
-    grep = Popen(["grep", "MHz"], stdin=cat.stdout)
+    grep = Popen(["grep", "MHz"], stdin=cat.stdout, stdout=PIPE)
     if grep.wait():
         return amount
-    sed = Popen(["sed", "-e", "s/[^0-9]//g"], stdin=grep.stdout)
+    sed = Popen(["sed", "-e", "s/[^0-9]//g"], stdin=grep.stdout, stdout=PIPE)
     if sed.wait():
         return amount
-    awk = Popen(["awk", "!x[$0]++"], stdin=sed.stdout)
+    awk = Popen(["awk", "!x[$0]++"], stdin=sed.stdout, stdout=PIPE)
     result = awk.wait()
     if not result:
-        amount = int(sed.communicate()[0])
+        amount = int(awk.communicate()[0])
     return amount
 
 def number_of_cpus():
@@ -65,14 +65,14 @@
     cat = Popen(["cat", "/proc/cpuinfo"], stdout=PIPE)
     if cat.wait():
         return amount
-    grep = Popen(["grep", "^processor"], stdin=cat.stdout)
+    grep = Popen(["grep", "^processor"], stdin=cat.stdout, stdout=PIPE)
     if grep.wait():
         return amount
-    sed = Popen(["sed", "-e", "s/[^0-9]//g"], stdin=grep.stdout)
+    sed = Popen(["sed", "-e", "s/[^0-9]//g"], stdin=grep.stdout, stdout=PIPE)
     if sed.wait():
         return amount
-    grep2 = Popen(["grep", "-c", ".*"], stdin=sed.stdout)
+    grep2 = Popen(["grep", "-c", ".*"], stdin=sed.stdout, stdout=PIPE)
     result = grep2.wait()
     if not result:
-        amount = int(sed.communicate()[0])
+        amount = int(grep2.communicate()[0])
     return amount



Mime
View raw message