diff --git a/kallithea/config/post_receive_tmpl.py b/kallithea/config/post_receive_tmpl.py --- a/kallithea/config/post_receive_tmpl.py +++ b/kallithea/config/post_receive_tmpl.py @@ -1,6 +1,15 @@ import os import sys +# set output mode on windows to binary for stderr +# this prevents python (or the windows console) from replacing \n with \r\n +# git doesn't display remote output lines that contain \r +# and therefore without this modification git would displayes empty lines +# instead of the exception output +if sys.platform == "win32": + import msvcrt + msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) + KALLITHEA_HOOK_VER = '_TMPL_' os.environ['KALLITHEA_HOOK_VER'] = KALLITHEA_HOOK_VER from kallithea.lib.hooks import handle_git_post_receive as _handler diff --git a/kallithea/config/pre_receive_tmpl.py b/kallithea/config/pre_receive_tmpl.py --- a/kallithea/config/pre_receive_tmpl.py +++ b/kallithea/config/pre_receive_tmpl.py @@ -1,6 +1,15 @@ import os import sys +# set output mode on windows to binary for stderr +# this prevents python (or the windows console) from replacing \n with \r\n +# git doesn't display remote output lines that contain \r +# and therefore without this modification git would displayes empty lines +# instead of the exception output +if sys.platform == "win32": + import msvcrt + msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) + KALLITHEA_HOOK_VER = '_TMPL_' os.environ['KALLITHEA_HOOK_VER'] = KALLITHEA_HOOK_VER from kallithea.lib.hooks import handle_git_pre_receive as _handler