Created
April 21, 2015 10:45
-
-
Save huyderman/6c50dfde4c5cc611b023 to your computer and use it in GitHub Desktop.
Fork with logger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'logger' | |
logger = Logger.new STDOUT | |
function = -> { logger.info "Something that takes a while..." } | |
# fork is not portable | |
if Process.respond_to?(:fork) | |
Process.detach fork(&function) | |
else | |
function | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment