From: Michael D. Lowis Date: Wed, 19 Jul 2017 17:01:48 +0000 (-0400) Subject: launch commands in the background instead of foreground with tide-fetch X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=0f0bd3eb61c2bce9ac0745c57bde80f70c6f9cdb;p=projs%2Ftide.git launch commands in the background instead of foreground with tide-fetch --- diff --git a/tide-fetch.rb b/tide-fetch.rb index a92ea66..add4271 100755 --- a/tide-fetch.rb +++ b/tide-fetch.rb @@ -27,14 +27,19 @@ def match(regex) end end +def spawn(cmd) + job = fork { exec cmd } + Process.detach(job) +end + def open_file - system("xdg-open #{$item}") + spawn("xdg-open #{$item}") end def open_with(app) app = Apps[app] || ENV[app.to_s.upcase] raise RuleError.new() if not app - system("#{app} #{$item}") + spawn("#{app} #{$item}") end def find_files(file)