diff options
author | hut <hut@lavabit.com> | 2009-06-13 04:12:18 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2009-06-13 04:12:18 +0200 |
commit | bd627dc4f2d009642de3ada13cbdc547490baf68 (patch) | |
tree | 116e882dd0d303cd8999e1a83c47965ba4a9458b /code/action.rb | |
parent | f55eb9bf0d7d2c252a6591324bfd8392d30c53da (diff) | |
download | ranger-bd627dc4f2d009642de3ada13cbdc547490baf68.tar.gz |
fixing & cleaning up
Diffstat (limited to 'code/action.rb')
-rw-r--r-- | code/action.rb | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/code/action.rb b/code/action.rb index 34a07242..7a0a9ac7 100644 --- a/code/action.rb +++ b/code/action.rb @@ -27,22 +27,13 @@ module Action rc ||= RunContext.new(Fm.getfiles) assert rc, RunContext - cf = Fm.currentfile - all = rc.all.or true - files = rc.files.or(all ? Fm.selection : [cf]) + files = rc.files mode = rc.mode.or 0 - newway = rc.newway.or false - return false if files.nil? + return false if files.nil? or files.empty? - if newway -# logpp files.first.handler -# rc = Fm.filehandler(files, struct) - handler = rc.exec - else - handler, wait = Fm.getfilehandler(*files) - end + handler = rc.exec return false unless handler @@ -52,15 +43,15 @@ module Action log handler if detach - run_detached(handler, new_term) + run_detached(handler, rc) else - run_inside(handler, wait) + run_inside(handler, rc) end return true end - def run_detached(what, new_term) - if new_term + def run_detached(what, rc) + if rc.new_term p = fork { exec('x-terminal-emulator', '-e', 'bash', '-c', what) } # Process.detach(p) else @@ -69,11 +60,11 @@ module Action end end - def run_inside(what, wait) - close_interface + def run_inside(what, rc) + close_interface unless rc.console system(*what) - wait_for_enter if wait - start_interface + wait_for_enter if rc.wait + start_interface unless rc.console end def wait_for_enter |