lib/howzit/task.rb in howzit-2.0.27 vs lib/howzit/task.rb in howzit-2.0.28

- old
+ new

@@ -54,15 +54,17 @@ script = Tempfile.new('howzit_script') begin script.write(block) script.close File.chmod(0o777, script.path) - system(%(/bin/sh -c "#{script.path}")) + res = system(%(/bin/sh -c "#{script.path}")) ensure script.close script.unlink end + + res end ## ## Execute an include task ## @@ -83,43 +85,44 @@ ## Execute a run task ## def run_run title = Howzit.options[:show_all_code] ? @action : @title Howzit.console.info("{bg}Running {bw}#{title}{x}".c) - system(@action) + return system(@action) end ## ## Execute a copy task ## def run_copy title = Howzit.options[:show_all_code] ? @action : @title Howzit.console.info("{bg}Copied {bw}#{title}{bg} to clipboard{x}".c) Util.os_copy(@action) + return true end ## ## Execute the task ## def run output = [] tasks = 1 - if @type == :block - run_block - else - case @type - when :include - output, tasks = run_include - when :run - run_run - when :copy - run_copy - when :open - Util.os_open(@action) - end - end + res = if @type == :block + run_block + else + case @type + when :include + output, tasks = run_include + when :run + run_run + when :copy + run_copy + when :open + Util.os_open(@action) + end + end - [output, tasks] + [output, tasks, res] end ## ## Output terminal-formatted list item ##