commit 4d0b6596a3fd608f26c1ff6c5e445601160ba99f from: Omar Polo via: Thomas Adam date: Fri Apr 14 16:27:57 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 - 6f97aa8325d21f12e6cd5d21353cc11899b9c75e commit + 4d0b6596a3fd608f26c1ff6c5e445601160ba99f blob - f69b2fc972e4829dd036416d66095d49c43ab0cb blob + 38fd7b70ea3e69af82d8890621885791d38b1202 --- got/got.c +++ got/got.c @@ -264,6 +264,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; }