term: fix ci output somehow

During CI (specifically, urbit-tests), slogs and printf output would
get interleaved, sometimes intermingling, mangling the resulting
output.

Best guess is this happens because of something weird we're doing with
regards to pushing output. Additional scatter-shot fflush calls solve
this. The fix herein also solves this. Unclear why, considering this
commit should result in identical behavior for the -t case.

Here be dragons.
This commit is contained in:
fang 2021-04-23 19:52:17 +02:00
parent 0ddde0b0d6
commit 9d6db9baaf
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972
5 changed files with 16 additions and 14 deletions

View File

@ -1084,7 +1084,7 @@
/* u3_term_io_loja(): release console from cooked print.
*/
void
u3_term_io_loja(int x);
u3_term_io_loja(int x, FILE* f);
/* u3_term_log_init(): initialize terminal for logging
*/

View File

@ -1559,8 +1559,9 @@ _http_init_tls(uv_buf_t key_u, uv_buf_t cer_u)
if( 0 == sas_i ) {
u3l_log("http: load private key failed:");
ERR_print_errors_fp(u3_term_io_hija());
u3_term_io_loja(1);
FILE* fil_u = u3_term_io_hija();
ERR_print_errors_fp(fil_u);
u3_term_io_loja(1, fil_u);
SSL_CTX_free(tls_u);
@ -1577,8 +1578,9 @@ _http_init_tls(uv_buf_t key_u, uv_buf_t cer_u)
if( 0 == sas_i ) {
u3l_log("http: load certificate failed:");
ERR_print_errors_fp(u3_term_io_hija());
u3_term_io_loja(1);
FILE* fil_u = u3_term_io_hija();
ERR_print_errors_fp(fil_u);
u3_term_io_loja(1,fil_u);
BIO_free(bio_u);
SSL_CTX_free(tls_u);

View File

@ -1527,7 +1527,7 @@ u3_term_io_hija(void)
/* u3_term_io_loja(): release console from fprintf.
*/
void
u3_term_io_loja(int x)
u3_term_io_loja(int x, FILE* f)
{
u3_utty* uty_u = _term_main();
@ -1540,8 +1540,8 @@ u3_term_io_loja(int x)
}
else {
if ( c3y == u3_Host.ops_u.tem ) {
fprintf(stdout, "\n");
fflush(stdout);
fprintf(f, "\n");
fflush(f);
}
else {
if ( 0 != _term_tcsetattr(1, TCSADRAIN, &uty_u->raw_u) ) {
@ -1570,7 +1570,7 @@ u3_term_io_loja(int x)
}
}
else {
fprintf(stdout, "\r\n");
fprintf(f, "\r\n");
}
}
@ -1582,7 +1582,7 @@ u3_term_io_log(c3_c* line)
FILE* stream = u3_term_io_hija();
int x = fprintf(stream, "%s", line);
fflush(stream);
u3_term_io_loja(x); //TODO remove arg? unused...
u3_term_io_loja(x, stream); //TODO remove arg? unused...
}
/* u3_term_tape_to(): dump a tape to a file.
@ -1614,7 +1614,7 @@ u3_term_tape(u3_noun tep)
u3_term_tape_to(fil_f, tep);
u3_term_io_loja(0);
u3_term_io_loja(0, fil_f);
}
/* u3_term_wall(): dump a wall to stdout.
@ -1633,7 +1633,7 @@ u3_term_wall(u3_noun wol)
wal = u3t(wal);
}
u3_term_io_loja(0);
u3_term_io_loja(0, fil_f);
u3z(wol);
}

View File

@ -938,7 +938,7 @@ u3_king_grab(void* vod_p)
}
#else
{
u3_term_io_loja(0);
u3_term_io_loja(0, fil_u);
}
#endif
}

View File

@ -2270,7 +2270,7 @@ u3_pier_tank(c3_l tab_l, c3_w pri_w, u3_noun tac)
fflush(fil_u);
u3_term_io_loja(0);
u3_term_io_loja(0, fil_u);
u3z(blu);
u3z(tac);
}