From 46069e7ee321ad035c5b1964026aa34fb5c06974 Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 12 Jun 2009 18:50:29 +0200 Subject: cleanup + removed relics from the dark ages --- code/fm/fm.rb | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'code/fm/fm.rb') diff --git a/code/fm/fm.rb b/code/fm/fm.rb index 1bf74081..6d0cc239 100644 --- a/code/fm/fm.rb +++ b/code/fm/fm.rb @@ -114,10 +114,15 @@ module Fm sleep 0.2 end + def terminal_killed? +# `ps ho tname --pid #{Process.pid}`.strip == '?' + Process.ppid == 1 + end + def main_loop bool = false while true - exit if Process.ppid == 1 + exit if terminal_killed? if @pwd.size == 0 or @pwd.pos < 0 @pwd.pos = 0 elsif @pwd.pos >= @pwd.size - 1 @@ -134,16 +139,8 @@ module Fm end begin -# unless bool -# bool = true - key = geti -# else -# key = geti -# key = 'j' -# end -# @mutex.synchronize { - press(key) -# } + key = geti + press(key) rescue Interrupt on_interrupt end -- cgit 1.4.1-2-gfad0