tools/kvm_stat: remove pid filter on empty input
authorStefan Raspl <raspl@linux.vnet.ibm.com>
Fri, 10 Mar 2017 12:40:09 +0000 (13:40 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 29 Mar 2017 10:01:29 +0000 (12:01 +0200)
Improve consistency in the interactive dialogue for pid filtering by
removing any filters on empty input (in addition to entering 0).

Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
tools/kvm/kvm_stat/kvm_stat

index 95ffa9a4b0446c6b56aaecbc782d849aabcb5b07..9e9eb983f6fef84ec4bd6d3234b954fc3ba8fc06 100755 (executable)
@@ -991,10 +991,13 @@ class Tui(object):
             curses.noecho()
 
             try:
-                pid = int(pid)
-                if pid != 0 and not os.path.isdir(os.path.join('/proc/',
-                                                               str(pid))):
-                    continue
+                if len(pid) > 0:
+                    pid = int(pid)
+                    if pid != 0 and not os.path.isdir(os.path.join('/proc/',
+                                                                   str(pid))):
+                        continue
+                else:
+                    pid = 0
                 self.refresh_header(pid)
                 self.update_pid(pid)
                 break