本文整理匯總了Python中GNUScreen._get_tty_pids_ps_with_cache_gen方法的典型用法代碼示例。如果您正苦於以下問題:Python GNUScreen._get_tty_pids_ps_with_cache_gen方法的具體用法?Python GNUScreen._get_tty_pids_ps_with_cache_gen怎麽用?Python GNUScreen._get_tty_pids_ps_with_cache_gen使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GNUScreen
的用法示例。
在下文中一共展示了GNUScreen._get_tty_pids_ps_with_cache_gen方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: find_pids_in_windows
# 需要導入模塊: import GNUScreen [as 別名]
# 或者: from GNUScreen import _get_tty_pids_ps_with_cache_gen [as 別名]
def find_pids_in_windows(session, datadir, pids):
import getpass
import os
tty_and_pids = sc._get_tty_pids_ps_with_cache_gen(getpass.getuser())
#print(tty_and_pids)
ttys = []
for (tty, tpids) in tty_and_pids.items():
#print('%s %s %s'%(pids,tty,tpids))
for pid in pids:
if pid in tpids:
ttys.append(tty)
wins = []
for (cwin, cgroupid, ctype, ctty, ctitle) in sc.gen_all_windows_fast(session,
datadir):
try:
ctty = int(os.path.split(ctty)[1])
if ctty in ttys:
wins.append(tuple([cwin, ctitle]))
except Exception:
pass
return wins