anchor.diff:  -define(CYCLE_TIMEOUT, 10000).
   -define(HEART_PORT_NAME, heart_port).
   
  +-record(state,{port :: port(),
  +               cmd  :: [] | binary()}).
  +
   %%---------------------------------------------------------------------
   
   -spec start() -> 'ignore' | {'error', term()} | {'ok', pid()}.
  
positive.code: 	    {error, Reason}
      end.
  
  loop(Parent, Port, Cmd) ->
      _ = send_heart_beat(Port),
      receive
  	{From, set_cmd, NewCmd0} ->
  
negative.code: 	    exit(normal)
      end.
  
  do_cycle_port_program(Caller, Parent, #state{port=Port} = S) ->
      unregister(?HEART_PORT_NAME),
      case catch start_portprogram() of
  	{ok, NewPort} ->
  	    _ = send_shutdown(Port),
  	    receive
  		{'EXIT', Port, _Reason} ->
  		    _ = send_heart_cmd(NewPort, S#state.cmd),
  		    Caller ! {heart, ok},
  		    loop(Parent, S#state{port=NewPort})
  	    after
  		?CYCLE_TIMEOUT ->
  		    %% Huh! Two heart port programs running...
  		    %% well, the old one has to be sick not to respond
  		    %% so we'll settle for the new one...
  		    _ = send_heart_cmd(NewPort, S#state.cmd),
  		    Caller ! {heart, {error, stop_error}},
  		    loop(Parent, S#state{port=NewPort})
  	    end;
  	no_heart ->
  	    Caller ! {heart, {error, no_heart}},
  	    loop(Parent, S);
  	error ->
  	    Caller ! {heart, {error, start_error}},
  	    loop(Parent, S)
      end.
      
  
  