Skip to content

Commit 7b21e68

Browse files
author
Matthias Radestock
committed
merge bug20518 into v1_5
2 parents 2076666 + 4dfb80b commit 7b21e68

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/rabbit_misc.erl

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,16 @@ ensure_parent_dirs_exist(Filename) ->
372372
end.
373373

374374
format_stderr(Fmt, Args) ->
375-
Port = open_port({fd, 0, 2}, [out]),
376-
port_command(Port, io_lib:format(Fmt, Args)),
377-
port_close(Port).
375+
case os:type() of
376+
{unix, _} ->
377+
Port = open_port({fd, 0, 2}, [out]),
378+
port_command(Port, io_lib:format(Fmt, Args)),
379+
port_close(Port);
380+
{win32, _} ->
381+
%% stderr on Windows is buffered and I can't figure out a
382+
%% way to trigger a fflush(stderr) in Erlang. So rather
383+
%% than risk losing output we write to stdout instead,
384+
%% which appears to be unbuffered.
385+
io:format(Fmt, Args)
386+
end,
387+
ok.

0 commit comments

Comments
 (0)