         console.log "[PROCESSES][#{name}]it's time you die process:#{name}" if verbose
         @kill name
       ,die.after
-
 
     @child.on 'exit', ()=>
       console.log "[PROCESSES][#{name}] did exit." if verbose

catch e
  # do nothing, probably dir is already there.

class Processes extends EventEmitter
  constructor:(options={})->
    {main}        = options
    @list         = {}
    @child        = null
    @workerProcess = {}
    @childProcessesContainerDir = __dirname+"/.tmp"
    if main

      stderr : process.stderr
      onExit  : callback

  # our main function is this. Either it is started normal, or it is wrapped
  # via kontrold amqp process
  run: (options,callback) ->
    {name, restartTimeout, verbose} = options

    options.name            ?= Date.now()
    options.restartTimeout  ?= 1000
    options.verbose         ?= no

    if options.kontrol?.enabled
