[orca] Make the output of 'orca -l' more verbose to identify non-responsive apps



commit 6380b6fccf2056120e376ecae607e38ded85f3e6
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Jun 7 07:13:55 2016 -0400

    Make the output of 'orca -l' more verbose to identify non-responsive apps

 src/orca/orca_bin.py.in |   28 +++++++++++++++++++++-------
 1 files changed, 21 insertions(+), 7 deletions(-)
---
diff --git a/src/orca/orca_bin.py.in b/src/orca/orca_bin.py.in
index 6a01713..f68517b 100644
--- a/src/orca/orca_bin.py.in
+++ b/src/orca/orca_bin.py.in
@@ -47,13 +47,27 @@ from orca.orca_platform import version
 
 class ListApps(argparse.Action):
     def __call__(self, parser, namespace, values, option_string=None):
-        try:
-            apps = filter(lambda x: x is not None, pyatspi.Registry.getDesktop(0))
-            names = [app.name for app in apps]
-        except:
-            pass
-        else:
-            print("\n".join(names))
+        desktop = pyatspi.Registry.getDesktop(0)
+        for app in desktop:
+            if app is None:
+                continue
+
+            pid = app.get_process_id()
+            try:
+                name = app.name or "(none)"
+            except:
+                name = "[DEAD]"
+
+            try:
+                cmdline = subprocess.getoutput('cat /proc/%s/cmdline' % pid)
+            except:
+                cmdline = '(exception encountered)'
+            else:
+                cmdline = cmdline.replace('\x00', ' ')
+
+            print(time.strftime('%H:%M:%S', time.localtime()),
+                  '  pid: %5s   %-25s  %s' % (pid, name, cmdline))
+
         parser.exit()
 
 class Settings(argparse.Action):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]