Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 73bcb76

Browse files
committed
Make stdout unbuffered
This ensures that all stdout output is flushed immediately, to match stderr. This eliminates the need for fflush(stdout) calls sprinkled all over the place. Per Daniel Wood in message 519A79C6.90308@salesforce.com
1 parent 13aa624 commit 73bcb76

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/test/isolation/isolationtester.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ exit_nicely(void)
7070

7171
for (i = 0; i < nconns; i++)
7272
PQfinish(conns[i]);
73-
fflush(stderr);
74-
fflush(stdout);
7573
exit(1);
7674
}
7775

@@ -101,6 +99,9 @@ main(int argc, char **argv)
10199
}
102100
}
103101

102+
/* make stdout unbuffered to match stderr */
103+
setbuf(stdout, NULL);
104+
104105
/*
105106
* If the user supplies a non-option parameter on the command line, use it
106107
* as the conninfo string; otherwise default to setting dbname=postgres
@@ -288,8 +289,6 @@ main(int argc, char **argv)
288289
/* Clean up and exit */
289290
for (i = 0; i < nconns; i++)
290291
PQfinish(conns[i]);
291-
fflush(stderr);
292-
fflush(stdout);
293292
return 0;
294293
}
295294

@@ -574,9 +573,7 @@ run_permutation(TestSpec * testspec, int nsteps, Step ** steps)
574573
* but it can only be unblocked by running steps from other
575574
* sessions.
576575
*/
577-
fflush(stdout);
578576
fprintf(stderr, "invalid permutation detected\n");
579-
fflush(stderr);
580577

581578
/* Cancel the waiting statement from this session. */
582579
cancel = PQgetCancel(conn);
@@ -664,7 +661,6 @@ run_permutation(TestSpec * testspec, int nsteps, Step ** steps)
664661
testspec->sessions[i]->name,
665662
PQerrorMessage(conns[i + 1]));
666663
/* don't exit on teardown failure */
667-
fflush(stderr);
668664
}
669665
PQclear(res);
670666
}
@@ -683,7 +679,6 @@ run_permutation(TestSpec * testspec, int nsteps, Step ** steps)
683679
fprintf(stderr, "teardown failed: %s",
684680
PQerrorMessage(conns[0]));
685681
/* don't exit on teardown failure */
686-
fflush(stderr);
687682
}
688683
PQclear(res);
689684
}

0 commit comments

Comments
 (0)