From 25a375f08d96b47ae9b7454e28abcae21b198976 Mon Sep 17 00:00:00 2001 From: Timothy Stack Date: Wed, 19 Aug 2015 21:02:26 -0700 Subject: [PATCH] [misc] fix various bugs --- src/curl_looper.hh | 1 + src/line_buffer.hh | 4 ++++ src/piper_proc.cc | 2 +- test/Makefile.am | 2 ++ test/test_cli.sh | 12 ++++++++++++ 5 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 test/test_cli.sh diff --git a/src/curl_looper.hh b/src/curl_looper.hh index 108856e5..13fa2a3d 100644 --- a/src/curl_looper.hh +++ b/src/curl_looper.hh @@ -167,6 +167,7 @@ public: log_debug("waiting for curl_looper thread"); pthread_join(this->cl_thread, &result); log_debug("curl_looper thread joined"); + this->cl_started = false; } }; diff --git a/src/line_buffer.hh b/src/line_buffer.hh index 3cab1a8c..22f3fa14 100644 --- a/src/line_buffer.hh +++ b/src/line_buffer.hh @@ -94,6 +94,10 @@ public: */ ssize_t get_file_size() const { return this->lb_file_size; }; + bool is_pipe() const { + return !this->lb_seekable; + }; + bool is_pipe_closed() const { return !this->lb_seekable && (this->lb_file_size != -1); }; diff --git a/src/piper_proc.cc b/src/piper_proc.cc index dc4713f2..cb7bff5b 100644 --- a/src/piper_proc.cc +++ b/src/piper_proc.cc @@ -171,7 +171,7 @@ piper_proc::piper_proc(int pipefd, bool timestamp, const char *filename) } last_off = off; } - } while (!lb.is_pipe_closed()); + } while (lb.is_pipe() && !lb.is_pipe_closed()); if (timestamp) { ssize_t wrc; diff --git a/test/Makefile.am b/test/Makefile.am index 6bcad71f..a489452a 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -169,6 +169,7 @@ scripty_LDADD = ../src/libdiag.a dist_noinst_SCRIPTS = \ parser_debugger.py \ + test_cli.sh \ test_cmds.sh \ test_curl.sh \ test_data_parser.sh \ @@ -275,6 +276,7 @@ TESTS = \ test_date_time_scanner \ test_format_installer.sh \ test_format_loader.sh \ + test_cli.sh \ test_cmds.sh \ test_concise \ test_line_buffer2 \ diff --git a/test/test_cli.sh b/test/test_cli.sh new file mode 100644 index 00000000..178f90be --- /dev/null +++ b/test/test_cli.sh @@ -0,0 +1,12 @@ +#! /bin/bash + +run_test ${lnav_test} -t -n <