Method: Daemon#exec

Defined in:
lib/carat-dev/daemon/daemon.rb

#exec(port, dir) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/carat-dev/daemon/daemon.rb', line 26

def exec( port, dir )
  if @debug then
    Dir.chdir dir
    wait 
    return
  end

  fork do
    Process.setsid
    fork do
      Dir.chdir dir
      $stdin.close
      $stdout.close
      $stderr.close

      wait
    end

    exit!
  end
  exit!
end