From e27a22ddf04e96e573d5fd97e968a8ef6b2b9f51 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Fri, 31 Jan 2014 12:41:52 -0500 Subject: [PATCH] devscript: uniq and sort running app bundles --- developer/bin/list_running_app_ids | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/developer/bin/list_running_app_ids b/developer/bin/list_running_app_ids index a07e86854d..1b47979366 100755 --- a/developer/bin/list_running_app_ids +++ b/developer/bin/list_running_app_ids @@ -22,6 +22,7 @@ end require 'open3' +running = {} out, err, status = Open3.capture3('/usr/bin/osascript', '-e', 'tell application "System Events" to get (name, bundle identifier, unix id) of every process') if status.exitstatus > 0 puts err @@ -34,13 +35,13 @@ app_names = out.shift(one_third) bundle_ids = out.shift(one_third) unix_ids = out.shift(one_third) -puts "bundle_id\tapp_name\n" -puts "--------------------------------------\n" app_names.zip(bundle_ids, unix_ids).each do |app_name, bundle_id, unix_id| next if bundle_id =~ %r{^com\.apple\.} next if app_name == 'osascript' # this script itself bundle_id.gsub!(/^(missing value)$/, '<\1>') - puts "#{bundle_id}\t#{app_name}\n" + running["#{bundle_id}\t#{app_name}"] = 1 end -# +puts "bundle_id\tapp_name\n" +puts "--------------------------------------\n" +puts running.keys.sort