anchor.diff:      ?log_error("Got unexpected exit signal from port: ~p. Exiting.", [Exit]),
       {stop, Reason, State}.
   
  -handle_call(unhandled, unhandled, unhandled) ->
  -    erlang:exit(unhandled).
  +handle_call(is_active, _From, State) ->
  +    {reply, is_port(State#state.port), State};
  +
  +handle_call(activate, _From, #state{port = P} = State) when is_port(P) ->
  +    {reply, {error, already_active}, State};
  +handle_call(activate, _From, #state{port = {inactive, Params}} = State) ->
  +    State2 = State#state{port = open_port(Params)},
  +    {reply, ok, State2}.
   
   handle_cast(unhandled, unhandled) ->
       erlang:exit(unhandled).
  
positive.code:         {stop, _, State2} -> State2
      end.
  
  terminate(shutdown, #state{send_eol = true, port = Port, name = Name} = State) ->
      ShutdownCmd = misc:get_env_default(ns_babysitter, port_shutdown_command, "shutdown"),
      ?log_debug("Sending ~s to port ~p", [ShutdownCmd, Name]),
  
negative.code: init(Fun) ->
      {Name, _Cmd, _Args, Opts} = Params = Fun(),
      process_flag(trap_exit, true), % Make sure terminate gets called
      Opts2 = proplists:delete(port_server_send_eol, proplists:delete(port_server_dont_start, Opts)),
      SendEOL = proplists:get_value(port_server_send_eol, Opts),
      DontStart = proplists:get_bool(port_server_dont_start, Opts),
      Params2 = erlang:setelement(4, Params, Opts2),
      Port = case DontStart of
                 false -> open_port(Params2);
                 true -> {inactive, Params2}
             end,
      {ok, #state{port = Port, name = Name, send_eol = SendEOL,
                  messages = ringbuffer:new(?NUM_MESSAGES)}}.
  
  handle_info({send_to_port, Msg}, #state{port = P} = State) when not is_port(P) ->
      ?log_debug("Got send_to_port when there's no port running yet. Will kill myself."),
      {stop, {unexpected_send_to_port, {send_to_port, Msg}}, State};
  handle_info({send_to_port, Msg}, State) ->
      ?log_debug("Sending the following to port: ~p", [Msg]),
      port_command(State#state.port, Msg),
  