提交 251e7dad 编写于 作者: J John Szakmeister 提交者: Junio C Hamano

diff-highlight: exit when a pipe is broken

While using diff-highlight with other tools, I have discovered that Python
ignores SIGPIPE by default.  Unfortunately, this also means that tools
attempting to launch a pager under Python--and don't realize this is
happening--means that the subprocess inherits this setting.  In this case, it
means diff-highlight will be launched with SIGPIPE being ignored.  Let's work
with those broken scripts by restoring the default SIGPIPE handler.
Signed-off-by: NJohn Szakmeister <john@szakmeister.net>
Acked-by: NJeff King <peff@peff.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 eeff891a
......@@ -14,6 +14,10 @@ my @removed;
my @added;
my $in_hunk;
# Some scripts may not realize that SIGPIPE is being ignored when launching the
# pager--for instance scripts written in Python.
$SIG{PIPE} = 'DEFAULT';
while (<>) {
if (!$in_hunk) {
print;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册