Use YYYY-MM-DDTHH_MM_SS
as datetime format for ICE dump files
Windows paths do not support `:`, so use a datetime format in ICE dump paths that Windows will accept. Fix #116809, fix #115180.
This commit is contained in:
parent
93e62a260f
commit
e1aa5adc78
3 changed files with 14 additions and 3 deletions
|
@ -62,7 +62,6 @@ use std::str;
|
|||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::OnceLock;
|
||||
use std::time::{Instant, SystemTime};
|
||||
use time::format_description::well_known::Rfc3339;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
#[allow(unused_macros)]
|
||||
|
@ -1307,7 +1306,13 @@ fn ice_path() -> &'static Option<PathBuf> {
|
|||
None => std::env::current_dir().unwrap_or_default(),
|
||||
};
|
||||
let now: OffsetDateTime = SystemTime::now().into();
|
||||
let file_now = now.format(&Rfc3339).unwrap_or_default();
|
||||
let file_now = now
|
||||
.format(
|
||||
// Don't use a standard datetime format because Windows doesn't support `:` in paths
|
||||
&time::format_description::parse("[year]-[month]-[day]T[hour]_[minute]_[second]")
|
||||
.unwrap(),
|
||||
)
|
||||
.unwrap_or_default();
|
||||
let pid = std::process::id();
|
||||
path.push(format!("rustc-ice-{file_now}-{pid}.txt"));
|
||||
Some(path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue