mirror of
https://github.com/tstack/lnav.git
synced 2024-09-11 13:05:51 +03:00
[piper] fix stall when logging partial match
This commit is contained in:
parent
937a4588f7
commit
e6aac98193
@ -119,15 +119,14 @@ multiplex_matcher::match(const string_fragment& line)
|
||||
return found{demux_pair.first};
|
||||
}
|
||||
|
||||
#if 0
|
||||
auto partial_size = df.dd_pattern.pp_value->match_partial(line);
|
||||
auto partial_size = df.dd_pattern.pp_value->match_partial(
|
||||
line.sub_range(0, 1024));
|
||||
if (partial_size > 0) {
|
||||
log_info(" only partial match by pattern: %s",
|
||||
df.dd_pattern.pp_value->get_pattern().c_str());
|
||||
log_info(" %s",
|
||||
line.sub_range(0, partial_size).to_string().c_str());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (df.dd_control_pattern.pp_value) {
|
||||
md = df.dd_control_pattern.pp_value->create_match_data();
|
||||
|
@ -96,7 +96,11 @@ detect_file_format(const std::filesystem::path& filename)
|
||||
filename.c_str());
|
||||
break;
|
||||
}
|
||||
auto li = load_res.unwrap();
|
||||
const auto li = load_res.unwrap();
|
||||
if (li.li_partial) {
|
||||
log_info("skipping demux match for partial line");
|
||||
break;
|
||||
}
|
||||
auto read_res = lb.read_range(li.li_file_range);
|
||||
if (read_res.isErr()) {
|
||||
log_error(
|
||||
|
@ -84,11 +84,21 @@ TEST_CASE("match")
|
||||
|
||||
TEST_CASE("partial")
|
||||
{
|
||||
static const char INPUT[] = "key1=1234";
|
||||
|
||||
auto co = lnav::pcre2pp::code::from_const(R"([a-z]+=.*)");
|
||||
auto matched = co.match_partial(string_fragment::from_const(INPUT));
|
||||
CHECK(matched == 3);
|
||||
|
||||
{
|
||||
static const char INPUT[] = "key1=1234";
|
||||
|
||||
auto matched = co.match_partial(string_fragment::from_const(INPUT));
|
||||
CHECK(matched == 3);
|
||||
}
|
||||
|
||||
{
|
||||
static const char INPUT[] = "key";
|
||||
|
||||
auto matched = co.match_partial(string_fragment::from_const(INPUT));
|
||||
CHECK(matched == 3);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("capture_name")
|
||||
|
Loading…
Reference in New Issue
Block a user