harry’s memorandum

おれおれメモ

2009-07-14から1日間の記事一覧

ruby で pstree

rubyで書く簡易版pstreeはこんな感じかな。 class PsTree def initialize @line = "-" @space = " " @table = Hash.new{|h,k| h[k] = []} proc_dat end def proc_dat Dir.glob("/proc/[0-9]*") {|dir| stat = stat_open("#{dir}/stat") pid = stat[0]; ppid …