Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

System exit does not wait for writing an error to a log #90

Open
tilfin opened this issue Dec 12, 2017 · 0 comments
Open

System exit does not wait for writing an error to a log #90

tilfin opened this issue Dec 12, 2017 · 0 comments

Comments

@tilfin
Copy link

tilfin commented Dec 12, 2017

I execute the following.

require 'serverengine'

module MyWorker
  def initialize
    1 / 0 # raise divided by 0
  end

  def run
    until @stop
      logger.info "Awesome work!"
      sleep 1
    end
  end

  def stop
    @stop = true
  end
end

se = ServerEngine.create(nil, MyWorker, {
  daemonize: false,
  log: 'myserver.log',
  pid_path: 'myserver.pid',
  worker: 1,
  worker_type: "thread",
})
se.run

But myserver.log does not contain the exception record.

I replace se.run with the following so that the logger works as expected.

begin
  se.run
rescue SystemExit
  sleep 1
end

I understand why this program works thus, but is this behavior specification?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant