whirly icon indicating copy to clipboard operation
whirly copied to clipboard

Suggestion: Make Whirly.start { # block } return the result of the block

Open aisrael opened this issue 1 year ago • 1 comments

Hi! Big fan of whirly, use it in almost all my scripts with long-running processes.

I frequently find myself going something like:

def foo
  Whirly.start
  result = do_foo
  Whirly
  result
end

Only because when Whirly.start is called with a block, it returns true.

I think that with a few code changes in whirly.rb#L168, we can make it return the result of the given block, allowing for:

def foo
  Whirly.start do
    do_foo
  end
end

I'd be happy to submit a PR if this suggestion is accepted.

aisrael avatar Sep 28 '22 13:09 aisrael

Thanks for the positive feedback!

Good idea, I'd be happy to merge such a PR!

janlelis avatar Sep 29 '22 13:09 janlelis