{"thread":{"id":"13785","subject":"[PATCH] cat-file --batch: flush stdout also when objects are missing","startedAt":"2008-06-03T18:34:17Z","lastAt":"2008-06-03T19:40:34Z","messageCount":2,"participants":["Lea Wiemann","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"78529","messageId":"1212518057-9137-1-git-send-email-LeWiemann@gmail.com","threadId":"13785","inReplyTo":null,"subject":"[PATCH] cat-file --batch: flush stdout also when objects are missing","fromName":"Lea Wiemann","fromEmail":"lewiemann@gmail.com","sentAt":"2008-06-03T18:34:17Z","receivedAt":"2008-06-03T18:34:17Z","isPatch":true,"sender":{"key":"lewiemann@gmail.com","avatar":null},"body":"cat-file --batch/--batch-check only flushes stdout when the object\nexists, but not when it doesn't (\"<object> missing\").  This makes\nbidirectional pipes hang.\n\nSigned-off-by: Lea Wiemann <LeWiemann@gmail.com>\n---\n builtin-cat-file.c |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin-cat-file.c b/builtin-cat-file.c\nindex 200345e..f8b3160 100644\n--- a/builtin-cat-file.c\n+++ b/builtin-cat-file.c\n@@ -159,6 +159,7 @@ static int batch_one_object(const char *obj_name, int print_contents)\n \n \tif (get_sha1(obj_name, sha1)) {\n \t\tprintf(\"%s missing\\n\", obj_name);\n+\t\tfflush(stdout);\n \t\treturn 0;\n \t}\n \n-- \n1.5.6.rc0.92.g27fd.dirty\n"},{"id":"78534","messageId":"7vve0q1f4d.fsf@gitster.siamese.dyndns.org","threadId":"13785","inReplyTo":"1212518057-9137-1-git-send-email-LeWiemann@gmail.com","subject":"Re: [PATCH] cat-file --batch: flush stdout also when objects are missing","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-03T19:40:34Z","receivedAt":"2008-06-03T19:40:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Lea Wiemann <lewiemann@gmail.com> writes:\n\n> cat-file --batch/--batch-check only flushes stdout when the object\n> exists, but not when it doesn't (\"<object> missing\").  This makes\n> bidirectional pipes hang.\n>\n> Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>\n> ---\n>  builtin-cat-file.c |    1 +\n>  1 files changed, 1 insertions(+), 0 deletions(-)\n>\n> diff --git a/builtin-cat-file.c b/builtin-cat-file.c\n> index 200345e..f8b3160 100644\n> --- a/builtin-cat-file.c\n> +++ b/builtin-cat-file.c\n> @@ -159,6 +159,7 @@ static int batch_one_object(const char *obj_name, int print_contents)\n>  \n>  \tif (get_sha1(obj_name, sha1)) {\n>  \t\tprintf(\"%s missing\\n\", obj_name);\n> +\t\tfflush(stdout);\n>  \t\treturn 0;\n>  \t}\n>  \n> -- \n> 1.5.6.rc0.92.g27fd.dirty\n\nAh, good catch.\n\nThanks.\n"}]}