def start
      if stopping?
        Procodile.log(@process.log_color, description, "Process is stopped/stopping therefore cannot be started again.")
        return false
      end

      update_pid
      if running?
        Procodile.log(@process.log_color, description, "Already running with PID #{@pid}")
        nil
      else
        if @supervisor.run_options[:port_allocations] && chosen_port = @supervisor.run_options[:port_allocations][@process.name]
          if chosen_port == 0
            allocate_port
          else
            @port = chosen_port
            Procodile.log(@process.log_color, description, "Assigned #{chosen_port} to process")
          end
        elsif @process.proxy? && @supervisor.tcp_proxy
          # Allocate a port randomly if a proxy is needed
          allocate_port
        elsif @process.allocate_port_from && @process.restart_mode != 'start-term'
          # Allocate ports to this process sequentially from the starting port
          allocated_ports = (@supervisor.processes[@process] ? @supervisor.processes[@process].select(&:running?) : []).map(&:port)
          proposed_port = @process.allocate_port_from
          until @port
            unless allocated_ports.include?(proposed_port)
              @port = proposed_port
            end
            proposed_port += 1
          end
        end

        if self.process.log_path && @supervisor.run_options[:force_single_log] != true
          log_destination = File.open(self.process.log_path, 'a')
          io = nil
        else
          reader, writer = IO.pipe
          log_destination = writer
          io = reader
        end
        @tag = @supervisor.tag.dup if @supervisor.tag
        Dir.chdir(@process.config.root)
        without_rbenv do
          @pid = ::Process.spawn(environment_variables, @process.command, :out => log_destination, :err => log_destination, :pgroup => true)
        end
        log_destination.close
        File.open(pid_file_path, 'w') { |f| f.write(@pid.to_s + "\n") }
        @supervisor.add_instance(self, io)
        ::Process.detach(@pid)
        Procodile.log(@process.log_color, description, "Started with PID #{@pid}" + (@tag ? " (tagged with #{@tag})" : ''))
        if self.process.log_path && io.nil?
          Procodile.log(@process.log_color, description, "Logging to #{self.process.log_path}")
        end
        @started_at = Time.now
      end
    end
def start
      if stopping?
        Procodile.log(@process.log_color, description, "Process is stopped/stopping therefore cannot be started again.")
        return false
      end

      update_pid
      if running?
        Procodile.log(@process.log_color, description, "Already running with PID #{@pid}")
        nil
      else
        if @supervisor.run_options[:port_allocations] && chosen_port = @supervisor.run_options[:port_allocations][@process.name]
          if chosen_port == 0
            allocate_port
          else
            @port = chosen_port
            Procodile.log(@process.log_color, description, "Assigned #{chosen_port} to process")
          end
        elsif @process.proxy? && @supervisor.tcp_proxy
          # Allocate a port randomly if a proxy is needed
          allocate_port
        elsif @process.allocate_port_from && @process.restart_mode != 'start-term'
          # Allocate ports to this process sequentially from the starting port
          allocated_ports = (@supervisor.processes[@process] ? @supervisor.processes[@process].select(&:running?) : []).map(&:port)
          proposed_port = @process.allocate_port_from
          until @port
            unless allocated_ports.include?(proposed_port)
              @port = proposed_port
            end
            proposed_port += 1
          end
        end

        if self.process.log_path && @supervisor.run_options[:force_single_log] != true
          log_destination = File.open(self.process.log_path, 'a')
          io = nil
        else
          reader, writer = IO.pipe
          log_destination = writer
          io = reader
        end
        @tag = @supervisor.tag.dup if @supervisor.tag
        Dir.chdir(@process.config.root)
        without_rbenv do
          @pid = ::Process.spawn(environment_variables, @process.command, :out => log_destination, :err => log_destination, :pgroup => true)
        end
        log_destination.close
        File.open(pid_file_path, 'w') { |f| f.write(@pid.to_s + "\n") }
        @supervisor.add_instance(self, io)
        ::Process.detach(@pid)
        Procodile.log(@process.log_color, description, "Started with PID #{@pid}" + (@tag ? " (tagged with #{@tag})" : ''))
        if self.process.log_path && io.nil?
          Procodile.log(@process.log_color, description, "Logging to #{self.process.log_path}")
        end
        @started_at = Time.now
      end
    end
Start a new instance of this process