From 28e62730d69293da0afafe64843af6bf6d90cf5b Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Sun, 6 Dec 2020 16:55:20 -0800 Subject: [PATCH] vere: fix printing of cord tanks (re-distinguish from serf stderr --- pkg/urbit/vere/lord.c | 25 ++++++++++++++++++++++++- pkg/urbit/vere/pier.c | 18 +++--------------- pkg/urbit/worker/main.c | 4 ++-- pkg/urbit/worker/serf.c | 3 ++- 4 files changed, 31 insertions(+), 19 deletions(-) diff --git a/pkg/urbit/vere/lord.c b/pkg/urbit/vere/lord.c index ba24e27fd0..2eb7a42e76 100644 --- a/pkg/urbit/vere/lord.c +++ b/pkg/urbit/vere/lord.c @@ -44,7 +44,8 @@ +$ plea $% [%live ~] [%ripe [pro=%1 hon=@ nok=@] eve=@ mug=@] - [%slog pri=@ ?(cord tank)] + [%slog pri=@ tank] + [%flog cord] $: %peek $% [%done dat=(unit (cask))] [%bail dud=goof] @@ -360,6 +361,24 @@ _lord_plea_slog(u3_lord* god_u, u3_noun dat) u3z(dat); } +/* _lord_plea_flog(): hear serf debug output +*/ +static void +_lord_plea_flog(u3_lord* god_u, u3_noun dat) +{ + u3_noun pri, tan; + c3_w pri_w; + + if ( c3n == u3a_is_atom(dat) ) { + return _lord_plea_foul(god_u, c3__slog, dat); + } + + c3_c* tan_c = u3r_string(tan); + u3C.stderr_log_f(tan_c); + c3_free(tan_c); + u3z(dat); +} + /* _lord_plea_peek_bail(): hear serf %peek %bail */ static void @@ -720,6 +739,10 @@ _lord_on_plea(void* ptr_v, c3_d len_d, c3_y* byt_y) _lord_plea_slog(god_u, u3k(dat)); } break; + case c3__flog: { + _lord_plea_flog(god_u, u3k(dat)); + } break; + case c3__play: { _lord_plea_play(god_u, u3k(dat)); } break; diff --git a/pkg/urbit/vere/pier.c b/pkg/urbit/vere/pier.c index 479f6a9a9a..eed35113ab 100644 --- a/pkg/urbit/vere/pier.c +++ b/pkg/urbit/vere/pier.c @@ -1256,23 +1256,11 @@ _pier_on_lord_slog(void* ptr_v, c3_w pri_w, u3_noun tan) { u3_pier* pir_u = ptr_v; - if ( c3y == u3a_is_atom(tan) ) { - c3_c* tan_c = u3r_string(tan); - u3C.stderr_log_f(tan_c); - c3_free(tan_c); - - if ( 0 != pir_u->sog_f ) { - pir_u->sog_f(pir_u->sop_p, pri_w, u3k(tan)); - } - } - else { - u3_pier_tank(0, pri_w, u3k(tan)); - if ( 0 != pir_u->sog_f ) { - pir_u->sog_f(pir_u->sop_p, pri_w, u3k(tan)); - } + if ( 0 != pir_u->sog_f ) { + pir_u->sog_f(pir_u->sop_p, pri_w, u3k(tan)); } - u3z(tan); + u3_pier_tank(0, pri_w, tan); } /* _pier_on_lord_save(): worker (non-portable) snapshot complete. diff --git a/pkg/urbit/worker/main.c b/pkg/urbit/worker/main.c index 8fe291522b..46895f093b 100644 --- a/pkg/urbit/worker/main.c +++ b/pkg/urbit/worker/main.c @@ -77,12 +77,12 @@ _cw_serf_send_slog(u3_noun hod) _cw_serf_send(u3nc(c3__slog, hod)); } -/* _cw_serf_send_stdr(): send stderr output +/* _cw_serf_send_stdr(): send stderr output (%flog) */ static void _cw_serf_send_stdr(c3_c* str_c) { - _cw_serf_send_slog(u3nc(0, u3i_string(str_c))); + _cw_serf_send(u3nc(c3__flog, u3i_string(str_c))); } diff --git a/pkg/urbit/worker/serf.c b/pkg/urbit/worker/serf.c index 7997d33f36..30553d94bd 100644 --- a/pkg/urbit/worker/serf.c +++ b/pkg/urbit/worker/serf.c @@ -46,7 +46,8 @@ +$ plea $% [%live ~] [%ripe [pro=%1 hon=@ nok=@] eve=@ mug=@] - [%slog pri=@ ?(cord tank)] + [%slog pri=@ tank] + [%flog cord] $: %peek $% [%done dat=(unit (cask))] [%bail dud=goof]