@@ -175,7 +175,6 @@ impl PersistentDataStore {
175175 . collect :: < Result < Vec < _ > , std:: io:: Error > > ( ) ?;
176176
177177 run_dirs. sort_unstable ( ) ;
178- run_dirs. pop ( ) ; // Don't include the current run.
179178 run_dirs. reverse ( ) ;
180179
181180 debug ! ( "Found past runs: {:?}" , run_dirs) ;
@@ -209,14 +208,19 @@ impl PersistentDataStore {
209208
210209 let mut ret = Vec :: new ( ) ;
211210
212- // Skip the first one as it is the current run.
213211 for dir in run_dirs. into_iter ( ) {
214212 debug ! ( "Reading run info from {}" , dir. display( ) ) ;
213+ let run_data = std:: fs:: read_to_string ( dir. join ( "run_info.json" ) ) ;
214+ let exit_data = std:: fs:: read_to_string ( dir. join ( "exit_info.json" ) ) ;
215+ if run_data. is_err ( ) || exit_data. is_err ( ) {
216+ // If we couldn't find one of the runfiles, just skip it. We can
217+ // fail to write it for a variety of reasons, including a simple
218+ // sigterm.
219+ continue ;
220+ }
215221
216- let run_info: RunInfo =
217- serde_json:: from_str ( & std:: fs:: read_to_string ( dir. join ( "run_info.json" ) ) ?) ?;
218- let exit_info: ExitInfo =
219- serde_json:: from_str ( & std:: fs:: read_to_string ( dir. join ( "exit_info.json" ) ) ?) ?;
222+ let run_info: RunInfo = serde_json:: from_str ( & run_data?) ?;
223+ let exit_info: ExitInfo = serde_json:: from_str ( & exit_data?) ?;
220224 ret. push ( ( run_info, exit_info) ) ;
221225 }
222226 Ok ( ret)
0 commit comments