summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@lshift.net>2009-03-30 09:33:34 +0100
committerMatthias Radestock <matthias@lshift.net>2009-03-30 09:33:34 +0100
commit7b21e68bf1e8d7b79c87463501ec49790ff6cd23 (patch)
tree99532be7c9c0477a38fd43ea77083bcfd5506c02
parent207666669781ca1c5a082b46dcad4f16c8817fff (diff)
parent4dfb80bf318aee02858c8afc34539826214a12e1 (diff)
downloadrabbitmq-server-git-7b21e68bf1e8d7b79c87463501ec49790ff6cd23.tar.gz
merge bug20518 into v1_5
-rw-r--r--src/rabbit_misc.erl16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl
index 5730fdc003..b15ad68ef4 100644
--- a/src/rabbit_misc.erl
+++ b/src/rabbit_misc.erl
@@ -372,6 +372,16 @@ ensure_parent_dirs_exist(Filename) ->
end.
format_stderr(Fmt, Args) ->
- Port = open_port({fd, 0, 2}, [out]),
- port_command(Port, io_lib:format(Fmt, Args)),
- port_close(Port).
+ case os:type() of
+ {unix, _} ->
+ Port = open_port({fd, 0, 2}, [out]),
+ port_command(Port, io_lib:format(Fmt, Args)),
+ port_close(Port);
+ {win32, _} ->
+ %% stderr on Windows is buffered and I can't figure out a
+ %% way to trigger a fflush(stderr) in Erlang. So rather
+ %% than risk losing output we write to stdout instead,
+ %% which appears to be unbuffered.
+ io:format(Fmt, Args)
+ end,
+ ok.