On 09-Jun-2021, at 18:36, Đoàn Trần Công Danh <congdanhqx@xxxxxxxxx> wrote: >>> >>> Overral I would replace the block inside capture_command with: >>> >>> -----8<----- >>> char *nextline; >>> char *line = sb_remote_out.buf; >>> while ((nextline = strchr(line, '\n')) != NULL) { >>> size_t len = nextline - line; >>> if (strip_suffix_mem(line, &len, "(fetch)")) >>> fprintf(output, " %.*s\n", (int)len, line); > > Fix-up for my suggestion: > > To be bug-for-bug with shell implementation, it should be: > > if (strip_suffix_mem(line, &len, " (fetch)")) That is very subtle, and I would have definitely missed it. Thanks.