Skip to content

process.daemonize behavior #55

@ghost

Description

If I have the option

process.daemonize = true

configured my start command cannot perform any sort of logging or output to stdout:

#!/usr/bin/env ruby
require 'logger'
class Job
  attr_accessor :logger
  def initialize
    @logger = Logger.new('job.log')
  end
  def log(string)
    @logger.info(string)
    # File.open('job.log', 'w') do |f|
    #   f.write(string)
    # end
    # puts string
  end

  def run
    a = []
    while true; a << 'x' * 1024; end
    log("size: #{a.size / 1024}M")
  end
end

j = Job.new
j.run

I also tried these options:

process.stdout = 'stdout.log'
process.stderr = 'stderr.log'

but did not see any notable change in behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions