diff --git a/core/src/G3Reader.cxx b/core/src/G3Reader.cxx index db0fceec..718c0d08 100644 --- a/core/src/G3Reader.cxx +++ b/core/src/G3Reader.cxx @@ -80,7 +80,7 @@ void G3Reader::Process(G3FramePtr frame, std::deque &out) if (Py_IsInitialized()) _save = PyEval_SaveThread(); - if (stream_.peek() == EOF) { + while (stream_.peek() == EOF) { if (filename_.size() > 0) { StartFile(filename_.front()); filename_.pop_front(); diff --git a/core/tests/fileio.py b/core/tests/fileio.py index 0b36de3f..72950458 100755 --- a/core/tests/fileio.py +++ b/core/tests/fileio.py @@ -46,7 +46,16 @@ def checkinfo(fr): n += 1 pipe.Add(checkinfo) pipe.Run() +assert n == 10, 'Wrong number of frames read (%d should be %d)' % (n, 10) +# Skip empty files +wr = core.G3Writer("empty.g3") +del wr +n = 0 +pipe = core.G3Pipeline() +pipe.Add(core.G3Reader, filename=["empty.g3", "test.g3", "empty.g3"], track_filename=True) +pipe.Add(checkinfo) +pipe.Run() assert n == 10, 'Wrong number of frames read (%d should be %d)' % (n, 10) # Indexing