anchor.diff:                      lists:delete(stderr_to_stdout, Opts2)
               end,
       ViaGoport = proplists:get_value(via_goport, Opts3, false),
  -    Opts = proplists:delete(via_goport, Opts3),
  +    Opts4 = proplists:delete(via_goport, Opts3),
  +
  +    %% don't split port output into lines if all we need to do is to redirect
  +    %% it into a file
  +    Opts = case Logger of
  +               undefined ->
  +                   [{line, 8192} | Opts4];
  +               _ ->
  +                   Opts4
  +           end,
   
       Port =
           case ViaGoport of
  
positive.code: log(_) ->
      ok.
  
  port_open({_Name, Cmd, Args, OptsIn}) ->
      %% Incoming options override existing ones (specified in proplists docs)
      Opts0 = OptsIn ++ [{args, Args}, exit_status,
                         {line, 8192}, stream, binary, stderr_to_stdout],
  
      WriteDataArg = proplists:get_value(write_data, Opts0),
      Opts1 = lists:keydelete(write_data, 1, Opts0),
  
negative.code: extract_message({eol, Msg}) ->
      Msg;
  extract_message({noeol, Msg}) ->
      Msg;
  extract_message(Msg) ->
      Msg.
  
  get_death_messages(#state{messages = Messages, logger = undefined}) ->
      %% we use line splitting for the processes whose output is not forwarded
      %% to disk
      misc:intersperse(ringbuffer:to_list(Messages), $\n);
  get_death_messages(#state{messages = Messages}) ->
      %% Since the messages here are not split in lines, they can be quite big
      %% and hence the total size of them can be quite a bit larger than
      %% ?KEEP_MESSAGES_BYTES. So we manually split them into lines here and
      %% select as few as possible.
      Combined = iolist_to_binary(ringbuffer:to_list(Messages)),
      Lines = binary:split(Combined, [<<"\n">>, <<"\r\n">>], [global]),
  
      R = lists:foldl(
            fun (Line, Acc) ->
                    ringbuffer:add(Line, byte_size(Line), Acc)
            end, ringbuffer:new(?KEEP_MESSAGES_BYTES), Lines),
  
      misc:intersperse(ringbuffer:to_list(R), $\n).
  