diff --git a/src/OutputByOrbit.cc b/src/OutputByOrbit.cc index ab8b40c79fb72096c99b6875a6d2fb2d773541e6..02d046e5a0b14322f857ed34ff30f2d73fca195a 100644 --- a/src/OutputByOrbit.cc +++ b/src/OutputByOrbit.cc @@ -29,11 +29,18 @@ void OutputByOrbitStream::OutputFixedOrbits(Slice &out) { control.output_force_write) { // i.e should be writing data n = fwrite(out.begin(), 1, out.size(), output_file_handler_.getFile(control.run_number, index)); + current_file_size += n; + } else if (output_file_handler_.hasFile()) { + // the run has been stopped so drop but first check if there is a last + // file to close + LOG(TRACE) << "the run was stopped. queueing the last file for close and " + "rename "; + output_file_handler_.enqueue_current_file_for_close_and_move_maybe(); } - current_file_size += n; + } else { // i.e should not currently be writing data - but then we should // never get here in the first place - output_file_handler_.enqueue_current_file_for_close_and_move_maybe(); + LOG(TRACE) << "got an empty slice "; } }