commit 8cdd231889a848b735f84ed6772eab46c2512db9 from: Omar Polo date: Thu Apr 13 06:41:46 2023 UTC got: flush stdout before printing the error in main() Since standard error is unbuffered, it could happen that the error string is printed immediately while the output from the subcommand is stuck in a buffer and written later. So flush() standard output before printing the error message. Problem reported by naddy@, ok stsp@ commit - 46108e23186237cccae84d88785fd31d692ef535 commit + 8cdd231889a848b735f84ed6772eab46c2512db9 blob - 9553f7382f214cf420ca01efb9c1237b54d89984 blob + 5b1264a0869935160185d8dbf60cfca23110939d --- got/got.c +++ got/got.c @@ -265,6 +265,7 @@ main(int argc, char *argv[]) error->code == GOT_ERR_ERRNO && errno == EPIPE) && !(sigint_received && error->code == GOT_ERR_ERRNO && errno == EINTR)) { + fflush(stdout); fprintf(stderr, "%s: %s\n", getprogname(), error->msg); return 1; }